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 <irogers@google.com> Link: https://lore.kernel.org/r/20250710235126.1086011-10-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
@@ -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[] = {
|
||||
|
||||
Reference in New Issue
Block a user