Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf python: Add optional cpus and threads arguments to parse_events

Used for the evlist initialization.

Reviewed-by: Howard Chu <howardchu95@gmail.com>
Signed-off-by: Ian Rogers <irogers@google.com>
Reviewed-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: https://lore.kernel.org/r/20250228222308.626803-7-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Ian Rogers and committed by
Namhyung Kim
6c62403b cc8bf352

+8 -2
+8 -2
tools/perf/util/python.c
··· 1339 1339 struct evlist evlist = {}; 1340 1340 struct parse_events_error err; 1341 1341 PyObject *result; 1342 + PyObject *pcpus = NULL, *pthreads = NULL; 1343 + struct perf_cpu_map *cpus; 1344 + struct perf_thread_map *threads; 1342 1345 1343 - if (!PyArg_ParseTuple(args, "s", &input)) 1346 + if (!PyArg_ParseTuple(args, "s|OO", &input, &pcpus, &pthreads)) 1344 1347 return NULL; 1345 1348 1349 + threads = pthreads ? ((struct pyrf_thread_map *)pthreads)->threads : NULL; 1350 + cpus = pcpus ? ((struct pyrf_cpu_map *)pcpus)->cpus : NULL; 1351 + 1346 1352 parse_events_error__init(&err); 1347 - evlist__init(&evlist, NULL, NULL); 1353 + evlist__init(&evlist, cpus, threads); 1348 1354 if (parse_events(&evlist, input, &err)) { 1349 1355 parse_events_error__print(&err, input); 1350 1356 PyErr_SetFromErrno(PyExc_OSError);