Re: [PATCH 6/9] perf report: Display the branch counter histogram

Liang, Kan
2024-08-07T11:57:42Z

Hi Namhyung,

On 2024-08-06 7:29 p.m., Namhyung Kim wrote:
>>>> 57.55% 2.5M 0.00% 3 |A |- | ...
>>>> 25.27% 1.1M 0.00% 2 |AA |- | ...
>>>> 15.61% 667.2K 0.00% 1 |A |- | ...
>>>> 0.16% 6.9K 0.81% 575 |A |- | ...
>>>> 0.16% 6.8K 1.38% 977 |AA |- | ...
>>>> 0.16% 6.8K 0.04% 28 |AA |B | ...
>>>> 0.15% 6.6K 1.33% 946 |A |- | ...
>>>> 0.11% 4.5K 0.06% 46 |AAA+|- | ...
>>>> 0.10% 4.4K 0.88% 624 |A |- | ...
>>>> 0.09% 3.7K 0.74% 524 |AAA+|B | ...
>>> I think this format assumes short width and might not work
>>> well when it has more events with bigger width. Maybe
>>> A=<n>, B=<n> ?
>> The purpose of "AAA" is to print a histogram here which can give the end
>> user a straightforward image of the distribution. The A=<n> may not be
>> that obvious.
> I understand your point. But I think we need to provide an easily
> parse-able format at least for CSV output.

I guess we may use a similar method of perf script in patch 8.

By default, the histogram will be output.
If an user want a number, -v should be used.

$perf report --total-cycles --stdio -v

# Sampled Cycles% Sampled Cycles Avg Cycles% Avg Cycles
Branch Counter >
# ............... .............. ........... ..........
.............................. ..................>
#
4.61% 116.4K 0.00% 91
A=3+,B=1 >
4.28% 108.0K 0.00% 26
A=1 ,B=1 >
3.42% 86.4K 0.00% 81
A=3+,B=1 >
2.84% 71.6K 0.00% 50
A=3+,B=- >
2.65% 66.8K 0.00% 178
A=3+,B=1 [__lock_acq>
2.26% 57.1K 0.00% 44
A=2 ,B=- >

Without -v,
$perf report --total-cycles --stdio

# Sampled Cycles% Sampled Cycles Avg Cycles% Avg Cycles
Branch Counter >
# ............... .............. ........... ..........
.............................. ..................>
#
4.61% 116.4K 0.00% 91
|AAA+|B+ | >
4.28% 108.0K 0.00% 26
|A |B | >
3.42% 86.4K 0.00% 81
|AAA+|B+ | >
2.84% 71.6K 0.00% 50
|AAA+|- | >
2.65% 66.8K 0.00% 178
|AAA+|B+ | [__lock_acq>
2.26% 57.1K 0.00% 44
|AA |- | >

What do you think?

Thanks,
Kan