diff options
| author | Ian Rogers <[email protected]> | 2025-07-10 23:51:22 +0000 |
|---|---|---|
| committer | Namhyung Kim <[email protected]> | 2025-07-11 19:36:40 +0000 |
| commit | 7d5b635d9f4314c93bc1f9828f5d757decb860bc (patch) | |
| tree | c08397ee14ed43fc62fdaf825e4230e216170bb6 /tools/perf/util/python.c | |
| parent | perf jevents: If the long_desc and desc are identical then drop the long_desc (diff) | |
| download | kernel-7d5b635d9f4314c93bc1f9828f5d757decb860bc.tar.gz kernel-7d5b635d9f4314c93bc1f9828f5d757decb860bc.zip | |
perf python: In str(evsel) use the evsel__pmu_name helper
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Namhyung Kim <[email protected]>
Diffstat (limited to 'tools/perf/util/python.c')
| -rw-r--r-- | tools/perf/util/python.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index b5ee9f7a4662..0821205b1aaa 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -925,10 +925,7 @@ static PyObject *pyrf_evsel__str(PyObject *self) struct pyrf_evsel *pevsel = (void *)self; struct evsel *evsel = &pevsel->evsel; - if (!evsel->pmu) - return PyUnicode_FromFormat("evsel(%s)", evsel__name(evsel)); - - return PyUnicode_FromFormat("evsel(%s/%s/)", evsel->pmu->name, evsel__name(evsel)); + return PyUnicode_FromFormat("evsel(%s/%s/)", evsel__pmu_name(evsel), evsel__name(evsel)); } static PyMethodDef pyrf_evsel__methods[] = { |
