[Patch v2 0/5] Bug fixes on topdown events reordering

Dapeng Mi
2024-07-08T07:40:37Z

Changes:
v1 -> v2"
* Use event/umask code instead of event name to indentify if an event
is a topdown slots/metric event (patch 1/5).
* Add perf tests to validate topdown events reordering including raw
format topdown events (patch 5/5).
* Drop the v1 patch 3/4 which doesn't move slots event if no topdown
metrics event in group.

Currently whether an event is a topdown slots/metric event is only
identified by comparing event name. It's inaccurate since topdown events
can be assigned by raw format and the event name is null in this case,
e.g.

perf stat -e '{instructions,cpu/r400/,cpu/r8300/}' sleep 1

Performance counter stats for 'sleep 1':

<not counted> instructions
<not counted> cpu/r400/
<not supported> cpu/r8300/

1.002917796 seconds time elapsed

0.002955000 seconds user
0.000000000 seconds sys

In this case slots and topdown-be-bound events are assigned by raw
format (slots:r400, topdown-be-bound:r8300) and they are not reordered
correctly.

The reason of dropping the patch "don't move slots event if no topdown
metric events in group" is that no any function issues but a warning is
introduced, and the cost of fixing this issue is expensive.

History:
v1: https://lore.kernel.org/all/20240702224037.343958-1-dapeng1.mi@linux.intel.com/

Dapeng Mi (5):
perf x86/topdown: Complete topdown slots/metrics events check
perf x86/topdown: Correct leader selection with sample_read enabled
perf x86/topdown: Don't move topdown metrics events when sorting
events
perf tests: Add leader sampling test in record tests
perf tests: Add topdown events counting and sampling tests

tools/perf/arch/x86/util/evlist.c | 9 ++---
tools/perf/arch/x86/util/evsel.c | 3 +-
tools/perf/arch/x86/util/topdown.c | 57 ++++++++++++++++++++++++++++--
tools/perf/arch/x86/util/topdown.h | 2 ++
tools/perf/tests/shell/record.sh | 34 ++++++++++++++++++
tools/perf/tests/shell/stat.sh | 6 ++++
6 files changed, 101 insertions(+), 10 deletions(-)

base-commit: 73e931504f8e0d42978bfcda37b323dbbd1afc08
--
2.40.1