perf python: Improve leader copying from evlist
authorIan Rogers <irogers@google.com>
Thu, 10 Jul 2025 23:51:25 +0000 (16:51 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Fri, 11 Jul 2025 19:36:40 +0000 (12:36 -0700)
commit421c5f39adcdf292ca5c7162f40ed6d120d136a8
tree35b902e1a4b76bb9bdfaa823bfd752a31f3f25ee
parent6183afcba9c1c810656ddb36170106aaf3cf778c
perf python: Improve leader copying from evlist

The struct pyrf_evlist embeds the evlist requiring the copying from
things like parsed events. The copying logic handles the leader being
the event itself, but if the leader group event is a different in the
list it will cause an evsel to point to the evsel in the list that was
copied from which is bad. Fix this by adding another pass over the
evlist rewriting leaders, simplified by the introductin of two evlist
helpers.

Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250710235126.1086011-13-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/python.c