This is an archive of the discontinued LLVM Phabricator instance.

[llvm-profdata] add value-cutoff functionality to show command
ClosedPublic

Authored by xur on Jan 4 2019, 4:57 PM.

Details

Summary

This patch improves llvm-profdata show command:
(1) add -value-cutoff=<N> option: only show function whose max count value is greater or equal to this cutoff value.
(2) add -list-below-cutoff option: output the functions whose max count value are below the cutoff value.
(3) format value-profile count values and print out the percentage.

Diff Detail

Event Timeline

xur created this revision.Jan 4 2019, 4:57 PM

why is list-below-cutoff option useful?

Please also update the documentation for llvm-profdata with the new options.

xur added a comment.Jan 7 2019, 11:31 AM

why is list-below-cutoff option useful?

it can be used to list all the 0-count functions, like "-list-below-cutoff -value-cutoff=1 "

Please also update the documentation for llvm-profdata with the new options.

xur updated this revision to Diff 180538.Jan 7 2019, 11:42 AM

Update llvm-prodata.rst per David's suggestion.

davidxl added inline comments.Jan 7 2019, 11:58 AM
docs/CommandGuide/llvm-profdata.rst
226

'Only output names of functions whose .... '

tools/llvm-profdata/llvm-profdata.cpp
674

ListBelow --> OnlyListBelow

702

!TextFormat && ListBelow

Text dump option is not compatible with ListBelow, and it should take precedence

811

Number of functions with maximum count (< " << ValueCutoff << "): " << ..

812

Functions -> functions

921

ListBelow --> OnlyListBelow

923

The semantics seems to be 'only list functions with ...'

xur updated this revision to Diff 180566.Jan 7 2019, 2:41 PM
xur marked 7 inline comments as done.

Integrated review comments from David.

davidxl added inline comments.Jan 7 2019, 2:50 PM
docs/CommandGuide/llvm-profdata.rst
221

value --> values

226

value -->values

tools/llvm-profdata/llvm-profdata.cpp
650

just use %.2f%% to remove the extra space

xur updated this revision to Diff 180573.Jan 7 2019, 3:13 PM

Updated based on David's review comments

davidxl accepted this revision.Jan 7 2019, 3:16 PM

lgtm

test/tools/llvm-profdata/value-prof.proftext
50

Remove space here.

This revision is now accepted and ready to land.Jan 7 2019, 3:16 PM
This revision was automatically updated to reflect the committed changes.