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>
This commit is contained in:
parent
84bd5aba88
commit
8294489914
@ -242,14 +242,20 @@ int __evlist__add_default(struct evlist *evlist, bool precise)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int evlist__add_dummy(struct evlist *evlist)
|
||||
static struct evsel *evlist__dummy_event(struct evlist *evlist)
|
||||
{
|
||||
struct perf_event_attr attr = {
|
||||
.type = PERF_TYPE_SOFTWARE,
|
||||
.config = PERF_COUNT_SW_DUMMY,
|
||||
.size = sizeof(attr), /* to capture ABI version */
|
||||
};
|
||||
struct evsel *evsel = evsel__new_idx(&attr, evlist->core.nr_entries);
|
||||
|
||||
return evsel__new_idx(&attr, evlist->core.nr_entries);
|
||||
}
|
||||
|
||||
int evlist__add_dummy(struct evlist *evlist)
|
||||
{
|
||||
struct evsel *evsel = evlist__dummy_event(evlist);
|
||||
|
||||
if (evsel == NULL)
|
||||
return -ENOMEM;
|
||||
|
Loading…
x
Reference in New Issue
Block a user