[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aPJQz475v3OmCqEl@Gautams-MacBook-Pro.local>
Date: Fri, 17 Oct 2025 19:51:03 +0530
From: Gautam Menghani <gautam@...ux.ibm.com>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Adrian Hunter <adrian.hunter@...el.com>,
Howard Chu <howardchu95@...il.com>, linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 2/3] perf python: Add PMU argument to parse_metrics
On Thu, Oct 16, 2025 at 03:22:27PM -0700, Ian Rogers wrote:
> Add an optional PMU argument to parse_metrics to allow restriction of
> the particular metrics to be opened. If no argument is provided then
> all metrics with the given name/group are opened
>
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
> tools/perf/util/python.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
> index 779fe1280a56..fa5e4270d182 100644
> --- a/tools/perf/util/python.c
> +++ b/tools/perf/util/python.c
> @@ -2051,7 +2051,7 @@ static PyObject *pyrf__parse_events(PyObject *self, PyObject *args)
>
> static PyObject *pyrf__parse_metrics(PyObject *self, PyObject *args)
> {
> - const char *input;
> + const char *input, *pmu = NULL;
> struct evlist evlist = {};
> PyObject *result;
> PyObject *pcpus = NULL, *pthreads = NULL;
> @@ -2059,14 +2059,14 @@ static PyObject *pyrf__parse_metrics(PyObject *self, PyObject *args)
> struct perf_thread_map *threads;
> int ret;
>
> - if (!PyArg_ParseTuple(args, "s|OO", &input, &pcpus, &pthreads))
> + if (!PyArg_ParseTuple(args, "s|sOO", &input, &pmu, &pcpus, &pthreads))
> return NULL;
>
> threads = pthreads ? ((struct pyrf_thread_map *)pthreads)->threads : NULL;
> cpus = pcpus ? ((struct pyrf_cpu_map *)pcpus)->cpus : NULL;
>
> evlist__init(&evlist, cpus, threads);
> - ret = metricgroup__parse_groups(&evlist, /*pmu=*/"all", input,
> + ret = metricgroup__parse_groups(&evlist, pmu ?: "all", input,
> /*metric_no_group=*/ false,
> /*metric_no_merge=*/ false,
> /*metric_no_threshold=*/ true,
> --
Acked-by: Gautam Menghani <gautam@...ux.ibm.com>
Powered by blists - more mailing lists