perf parse-events: Fix missing slots for Intel topdown metric events
authorIan Rogers <irogers@google.com>
Sat, 19 Jul 2025 03:05:16 +0000 (20:05 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 24 Jul 2025 20:41:35 +0000 (13:41 -0700)
commit8dcd27b1b8661f64e220bc26a499865261d5d0f1
tree19fa320c5436dc4b23b54dab76ff910c2a4ecb20
parent5b546de9cc177936a3ed07d7d46ef072db4fdbab
perf parse-events: Fix missing slots for Intel topdown metric events

Topdown metric events require grouping with a slots event. In perf
metrics this is currently achieved by metrics adding an unnecessary
"0 * tma_info_thread_slots". New TMA metrics trigger optimizations of
the metric expression that removes the event and breaks the metric due
to the missing but required event. Add a pass immediately before
sorting and fixing parsed events, that insert a slots event if one is
missing. Update test expectations to match this.

Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250719030517.1990983-15-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/arch/x86/util/evlist.c
tools/perf/arch/x86/util/topdown.c
tools/perf/arch/x86/util/topdown.h
tools/perf/tests/parse-events.c
tools/perf/util/evlist.h
tools/perf/util/parse-events.c