perf evsel: Add evsel__prepare_open()

This function will prepare the evsel and disable the missing features.
It will be used in one of the following patches.

Signed-off-by: Riccardo Mancini <rickyman7@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/fa5e78bbb92c848226f044278fdcf777b3ce4583.1629490974.git.rickyman7@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Riccardo Mancini 2021-08-21 11:19:24 +02:00 committed by Arnaldo Carvalho de Melo
parent 588f4ac763
commit 6efd06e374
2 changed files with 16 additions and 0 deletions

View File

@ -1827,6 +1827,20 @@ static void evsel__disable_missing_features(struct evsel *evsel)
evsel->core.attr.sample_id_all = 0;
}
int evsel__prepare_open(struct evsel *evsel, struct perf_cpu_map *cpus,
struct perf_thread_map *threads)
{
int err;
err = __evsel__prepare_open(evsel, cpus, threads);
if (err)
return err;
evsel__disable_missing_features(evsel);
return err;
}
static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,
struct perf_thread_map *threads,
int start_cpu, int end_cpu)

View File

@ -287,6 +287,8 @@ int evsel__open_per_thread(struct evsel *evsel, struct perf_thread_map *threads)
int evsel__open(struct evsel *evsel, struct perf_cpu_map *cpus,
struct perf_thread_map *threads);
void evsel__close(struct evsel *evsel);
int evsel__prepare_open(struct evsel *evsel, struct perf_cpu_map *cpus,
struct perf_thread_map *threads);
struct perf_sample;