summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRiccardo Mancini <rickyman7@gmail.com>2021-08-21 12:19:24 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2021-08-31 22:36:54 +0300
commit6efd06e3741944e528bc8243c88d9e3320c1c80c (patch)
tree5a4581f2787d8560a75b7f2f58331dcf319e5437 /tools
parent588f4ac7639941d12fa669c30e64e0d68fb96b08 (diff)
downloadlinux-6efd06e3741944e528bc8243c88d9e3320c1c80c.tar.xz
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/evsel.c14
-rw-r--r--tools/perf/util/evsel.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index f0bc89f74391..45d778f063d4 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -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)
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 76efcfa3e14d..b173700db8af 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -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;