Skip to content

Commit 2079b4b

Browse files
committed
perf python: In str(evsel) use the evsel__pmu_name helper
JIRA: https://issues.redhat.com/browse/RHEL-78198 upstream ======== commit 7d5b635 Author: Ian Rogers <irogers@google.com> Date: Thu Jul 10 16:51:22 2025 -0700 description =========== The evsel__pmu_name helper will internally use evsel__find_pmu that handles legacy events, extended types, etc. in determining a PMU and will provide a better value than just trying to access the PMU's name directly as the PMU may not have been computed. Signed-off-by: Ian Rogers <irogers@google.com> Link: https://lore.kernel.org/r/20250710235126.1086011-10-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Michael Petlan <mpetlan@redhat.com>
1 parent ee31088 commit 2079b4b

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

tools/perf/util/python.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -925,10 +925,7 @@ static PyObject *pyrf_evsel__str(PyObject *self)
925925
struct pyrf_evsel *pevsel = (void *)self;
926926
struct evsel *evsel = &pevsel->evsel;
927927

928-
if (!evsel->pmu)
929-
return PyUnicode_FromFormat("evsel(%s)", evsel__name(evsel));
930-
931-
return PyUnicode_FromFormat("evsel(%s/%s/)", evsel->pmu->name, evsel__name(evsel));
928+
return PyUnicode_FromFormat("evsel(%s/%s/)", evsel__pmu_name(evsel), evsel__name(evsel));
932929
}
933930

934931
static PyMethodDef pyrf_evsel__methods[] = {

0 commit comments

Comments
 (0)