[RFC PATCH 1/1] perf arm64: Implement --topdown with metrics

Andrew Kilroy andrew.kilroy at arm.com
Tue Dec 21 06:31:54 PST 2021



On 17/12/2021 10:19, John Garry wrote:
> On 14/12/2021 18:42, Andrew Kilroy wrote:
>> This patch implements the --topdown option by making use of metrics to
>> dictate what counters are obtained in order to show the various topdown
>> columns, e.g.  Frontend Bound, Backend Bound, Retiring and Bad
>> Speculation.
>>
>> The MetricGroup name is used to identify which set of metrics are to be
>> shown.  For the moment use TopDownL1 and enable for arm64
>>
>> Signed-off-by: Andrew Kilroy<andrew.kilroy at arm.com>
> 
> This works in that it gives results, but does not supply the same output 
> format as for x86 nor has same restrictions in usage (-a commandline 
> required, for example, below).
> 
> For my x86 broadwell:
> 
> john at localhost:~/linux/tools/perf> sudo ./perf stat --topdown  sleep 1
> top down event configuration requires system-wide mode (-a)
> 
> john at localhost:~/linux/tools/perf> sudo ./perf stat --topdown -a sleep 1
> Performance counter stats for 'system wide':
> 
>                                     retiring      bad speculation 
> frontend bound        backend bound
> S0-D0-C0           2                29.2%                 6.3%      
> 37.4%                27.1%
> S0-D0-C1           2                20.4%                 6.2%      
> 42.1%                31.3%
> 
>        0.998007338 seconds time elapsed
> 
> john at localhost:~/linux/tools/perf>
> 

Judging by comments in commits 44b1e60ab576c, 55c36a9fc2aaa, whether -a 
is required or not differs depending on the cpu.  As to why, I'm not 
sure.  The requirement was relaxed in 55c36a9fc2aaa, but I guess that 
doesn't affect the broadwell.

The stats are printed per cpu because on your broadwell, the existing 
code is forcing per-core mode.  Hence why -a is required.  See 
builtin-stat.c lines 1885-1890 on commit 8ff4f20f3eb55.

My patch wasn't forcing per-core, hence it didn't require -a.


Andrew



More information about the linux-arm-kernel mailing list