Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add record and report features and fix some issues #534

Merged
merged 3 commits into from
Oct 7, 2023

Conversation

jyf111
Copy link
Contributor

@jyf111 jyf111 commented Sep 30, 2023

Pull Request Template

Description

Add record and report features and fix some issues.

  1. fix 32-bit program issues (-m32)
  2. fix memory issues (-fsanitize=address)
  3. add record and report features

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

$ sudo build/utrace -c test/strcpy --record --output=/dev/null
Tracing...
Detaching...
$ du -bh utrace.data 
1.1K    utrace.data # saves the traced data
$ build/utrace --report --format=summary
  TOTAL TIME  |  SELF TIME  |  CALLS  |  FUNCTION
============================================================
   208.526 us    165.075 us        1      main
    20.828 us     20.828 us        2      malloc
    12.636 us     12.636 us        4      strlen
     5.015 us      5.015 us        2      free
     2.508 us      2.508 us        1      memset
     2.464 us      2.464 us        1      memcpy
============================================================
$ build/utrace --report --format=summary --avg-self --percent-self
  PERCENT  |   SELF AVG  |   SELF MIN  |  SELF MAX  |   SELF TIME  |  CALLS  |  FUNCTION
==================================================================================================================
   79.16%     165.075 us    165.075 us    165.075 us     165.075 us        1      main
    9.98%      10.414 us      2.453 us     18.375 us      20.828 us        2      malloc
    6.05%       3.159 us      2.431 us      5.341 us      12.636 us        4      strlen
    2.40%       2.507 us      2.431 us      2.584 us       5.015 us        2      free
    1.20%       2.508 us      2.508 us      2.508 us       2.508 us        1      memset
    1.18%       2.464 us      2.464 us      2.464 us       2.464 us        1      memcpy
==================================================================================================================

We can also add --function, --no-function, --lib, --no-lib, --max-depth, and --time-filter options when reporting the pre-traced data.

We can also output flame graph.

$ build/utrace --report --format=flame-graph --sample-time=1us --output ./flame
$ git clone https://github.com/brendangregg/FlameGraph --depth 1
$ FlameGraph/flamegraph.pl ./flame > ./flame.svg

flame

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Copy link
Member

@helight helight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chenamy2017 chenamy2017 merged commit 1e6b680 into linuxkerneltravel:develop Oct 7, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants