Bug 401454 - Add a --show-percs option to cg_annotate and callgrind_annotate.
Summary: Add a --show-percs option to cg_annotate and callgrind_annotate.
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: cachegrind (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Nicholas Nethercote
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-27 04:08 UTC by Nick Nethercote
Modified: 2019-01-27 10:05 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
patch (119.08 KB, patch)
2018-11-27 04:08 UTC, Nick Nethercote
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Nethercote 2018-11-27 04:08:47 UTC
Created attachment 116523 [details]
patch

Add a --show-percs option to cg_annotate and callgrind_annotate.
   
Because it's very useful. As part of this, the "percentage of events
annotated" numbers at the bottom of the output is changed to "events
annotated" so that --show-percs doesn't compute a percentage of a
percentage.
    
Example output lines:

> 4,967,137,442 (100.0%)  PROGRAM TOTALS
>     
> 4,543 (25.23%)    17,566 ( 0.43%)    47,993 ( 0.92%) /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c
>     
> 1 ( 0.01%) 2,000,001 (49.29%) 3,000,004 (57.36%)     for (int i = 0; i < 1000000; i++) {

The commit also adds some much-needed tests for cg_annotate and
callgrind_annotate.
Comment 1 Nick Nethercote 2018-12-05 13:21:00 UTC
I don't think this will be a controversial change, given that it doesn't change default behaviours. I will land it early next week if there are no objections in the meantime.