2019-11-30 21:22:15

by Ivan Babrou

[permalink] [raw]
Subject: Misaligned output of perf stat --topdown

Hey,

I'm observing misaligned output of perf stat --topdown:

$ sudo perf stat --topdown --cpu 1 -a find /state > /dev/null

Performance counter stats for 'system wide':

retiring bad speculation
frontend bound backend bound
S0-D0-C1 1 30.4% 13.4%
38.0% 18.2%

$ sudo perf stat --topdown --cpu 1 -a find /state > /dev/null

Performance counter stats for 'system wide':

retiring bad speculation
frontend bound backend bound
S0-D0-C1 1 27.5% 6.5%
24.1% 41.9%

$ sudo perf stat --topdown --cpu 1 -a find /state > /dev/null

Performance counter stats for 'system wide':

retiring bad speculation
frontend bound backend bound
S0-D0-C1 1 29.6% 12.3%
23.7% 34.4%

It may be hard to notice in narrow plaintext email, so here's a gist:

* https://gist.github.com/bobrik/ea5ddd8eb1629c350c898093f39ac7ee

I think there are two issues:

* Sometimes output is misaligned, which may or may not depend on the
length of the printed value (<10.0% is misaligned, >=10.0% is ok)
* Values are never really aligned to headers (except for maybe the first column)

This is on 5.4.0.