diff options
| author | Andi Kleen <ak@linux.intel.com> | 2026-05-13 07:49:06 -0700 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-05-22 17:25:02 -0300 |
| commit | 7a978c2ac722d527852c0239ecc71108547c7a23 (patch) | |
| tree | 3948360fe62e1c60fd049815c9e37c7a2ef847a5 /tools/perf/scripts/python/bin/stackcollapse-record | |
| parent | 6c1b9c1ed6699298fdf7889874dc033f1cc5c8a7 (diff) | |
perf stat: Make metric only column line up with header
Since some time the metric-only output columns are messed up and do not
line up with the header, which makes it hard to read. I haven't bisected
it, but presumably it was broken for some time.
There were multiple problems:
- The dummy pm invocation at the beginning did print a bogus field
- The column computation in pm did not agree with the header length
- The color escape strings from highlighting confuse printf's field
length computation
Fix all those. I simplified the column width computation significantly,
ignoring EVNAME_LEN, MGROUP_LEN, config->unit_width which don't
seem to be useful in the metric only context. It now only uses
the actual unit width as well as config->metric_only_len. The result
is more code removed than added.
Before:
% perf stat --topdown -a -I 1000
+ time % tma_backend_bound % tma_frontend_bound % tma_bad_speculation % tma_retiring
1.000190386 45.5 40.0 5.3 9.2
2.005185654 45.3 40.1 5.6 9.0
3.009193207 45.4 39.9 5.6 9.1
After:
% perf stat --topdown -a -I 1000
+ time % tma_backend_bound % tma_frontend_bound % tma_bad_speculation % tma_retiring
1.000810024 46.3 39.7 5.3 8.7
2.004800656 45.8 39.8 5.4 8.9
3.008804783 46.0 39.6 5.4 9.0
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-record')
0 files changed, 0 insertions, 0 deletions
