diff options
| author | Ian Rogers <[email protected]> | 2025-02-28 22:23:03 +0000 |
|---|---|---|
| committer | Namhyung Kim <[email protected]> | 2025-03-12 01:55:37 +0000 |
| commit | 6c62403b5ad4511090d2f3ffd00d4cc6fc608480 (patch) | |
| tree | fade078aeaaebf5b387d9e793c88bf371aa607c1 /tools/perf/util/python.c | |
| parent | perf python: Add member access to a number of evsel variables (diff) | |
| download | kernel-6c62403b5ad4511090d2f3ffd00d4cc6fc608480.tar.gz kernel-6c62403b5ad4511090d2f3ffd00d4cc6fc608480.zip | |
perf python: Add optional cpus and threads arguments to parse_events
Used for the evlist initialization.
Reviewed-by: Howard Chu <[email protected]>
Signed-off-by: Ian Rogers <[email protected]>
Reviewed-by: Arnaldo Carvalho de Melo <[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 | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index b600b6379b4e..4a3015e7dc83 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -1339,12 +1339,18 @@ static PyObject *pyrf__parse_events(PyObject *self, PyObject *args) struct evlist evlist = {}; struct parse_events_error err; PyObject *result; + PyObject *pcpus = NULL, *pthreads = NULL; + struct perf_cpu_map *cpus; + struct perf_thread_map *threads; - if (!PyArg_ParseTuple(args, "s", &input)) + if (!PyArg_ParseTuple(args, "s|OO", &input, &pcpus, &pthreads)) return NULL; + threads = pthreads ? ((struct pyrf_thread_map *)pthreads)->threads : NULL; + cpus = pcpus ? ((struct pyrf_cpu_map *)pcpus)->cpus : NULL; + parse_events_error__init(&err); - evlist__init(&evlist, NULL, NULL); + evlist__init(&evlist, cpus, threads); if (parse_events(&evlist, input, &err)) { parse_events_error__print(&err, input); PyErr_SetFromErrno(PyExc_OSError); |
