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 evlist.config to set up record options

Add access to evlist__config that is used to configure an evlist with
record options.

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

authored by

Ian Rogers and committed by
Namhyung Kim
0dfcc7c8 1a8356fb

+33
+33
tools/perf/util/python.c
··· 9 9 #include <event-parse.h> 10 10 #endif 11 11 #include <perf/mmap.h> 12 + #include "callchain.h" 12 13 #include "evlist.h" 13 14 #include "evsel.h" 14 15 #include "event.h" 15 16 #include "print_binary.h" 17 + #include "record.h" 16 18 #include "strbuf.h" 17 19 #include "thread_map.h" 18 20 #include "trace-event.h" ··· 1054 1052 return Py_None; 1055 1053 } 1056 1054 1055 + static PyObject *pyrf_evlist__config(struct pyrf_evlist *pevlist) 1056 + { 1057 + struct record_opts opts = { 1058 + .sample_time = true, 1059 + .mmap_pages = UINT_MAX, 1060 + .user_freq = UINT_MAX, 1061 + .user_interval = ULLONG_MAX, 1062 + .freq = 4000, 1063 + .target = { 1064 + .uses_mmap = true, 1065 + .default_per_cpu = true, 1066 + }, 1067 + .nr_threads_synthesize = 1, 1068 + .ctl_fd = -1, 1069 + .ctl_fd_ack = -1, 1070 + .no_buffering = true, 1071 + .no_inherit = true, 1072 + }; 1073 + struct evlist *evlist = &pevlist->evlist; 1074 + 1075 + evlist__config(evlist, &opts, &callchain_param); 1076 + Py_INCREF(Py_None); 1077 + return Py_None; 1078 + } 1079 + 1057 1080 static PyObject *pyrf_evlist__disable(struct pyrf_evlist *pevlist) 1058 1081 { 1059 1082 evlist__disable(&pevlist->evlist); ··· 1135 1108 .ml_meth = (PyCFunction)pyrf_evlist__read_on_cpu, 1136 1109 .ml_flags = METH_VARARGS | METH_KEYWORDS, 1137 1110 .ml_doc = PyDoc_STR("reads an event.") 1111 + }, 1112 + { 1113 + .ml_name = "config", 1114 + .ml_meth = (PyCFunction)pyrf_evlist__config, 1115 + .ml_flags = METH_NOARGS, 1116 + .ml_doc = PyDoc_STR("Apply default record options to the evlist.") 1138 1117 }, 1139 1118 { 1140 1119 .ml_name = "disable",