Open jg-linetco opened 10 months ago
IMHO we should bring back the old behavior and move the "weighting" behavior behind a command line option.
I understand that there's demand to have the samples weighted by the amount the cycle counter increased between the last sample and this sample.
So my proposal would is: Let's bring back the old behavior (sample count) as default behavior and add new command line option to enable the period-weighting of samples.
--periods "Weight samples according to the reported event period"
What do you think? I'll be happy to create the PR. @kgibm already did most of the work in #297 ;-)
Issue
When using the instruction from https://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html the number of samples according to perf and the number of samples according to the flame graph differ greatly. Example numbers:
The flame graph reports billions of samples:
Notes
The example flamegraph on https://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html does report correct numbers.
First Analysis
This change has been introduced with https://github.com/brendangregg/FlameGraph/issues/165 in PR https://github.com/brendangregg/FlameGraph/pull/250
From there on, samples are weighted by a factor but still reported as "samples", making the output of perf and flamegraph contradictory.