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

perf evlist: Factor out evlist__dummy_event()

Factor out evlist__dummy_event() so it can be reused.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Leo Yan <leo.yan@linaro.org>
Link: https://lore.kernel.org/r/20220524075436.29144-5-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Adrian Hunter and committed by
Arnaldo Carvalho de Melo
82944899 84bd5aba

+8 -2
+8 -2
tools/perf/util/evlist.c
··· 242 242 return 0; 243 243 } 244 244 245 - int evlist__add_dummy(struct evlist *evlist) 245 + static struct evsel *evlist__dummy_event(struct evlist *evlist) 246 246 { 247 247 struct perf_event_attr attr = { 248 248 .type = PERF_TYPE_SOFTWARE, 249 249 .config = PERF_COUNT_SW_DUMMY, 250 250 .size = sizeof(attr), /* to capture ABI version */ 251 251 }; 252 - struct evsel *evsel = evsel__new_idx(&attr, evlist->core.nr_entries); 252 + 253 + return evsel__new_idx(&attr, evlist->core.nr_entries); 254 + } 255 + 256 + int evlist__add_dummy(struct evlist *evlist) 257 + { 258 + struct evsel *evsel = evlist__dummy_event(evlist); 253 259 254 260 if (evsel == NULL) 255 261 return -ENOMEM;