From 384c4ad192a01fe235c7ac9e9fd8605d12a807e8 Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Sun, 21 Jul 2019 13:24:57 +0200 Subject: [PATCH] libperf: Add perf_evsel__attr() function Add a perf_evsel__attr() function to get attr pointer from a perf_evsel instance. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Alexey Budankov Cc: Andi Kleen Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20190721112506.12306-71-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/lib/evsel.c | 5 +++++ tools/perf/lib/include/perf/evsel.h | 1 + tools/perf/lib/libperf.map | 1 + 3 files changed, 7 insertions(+) diff --git a/tools/perf/lib/evsel.c b/tools/perf/lib/evsel.c index 8dbe0e841b8f..24abc80dd767 100644 --- a/tools/perf/lib/evsel.c +++ b/tools/perf/lib/evsel.c @@ -225,3 +225,8 @@ struct perf_thread_map *perf_evsel__threads(struct perf_evsel *evsel) { return evsel->threads; } + +struct perf_event_attr *perf_evsel__attr(struct perf_evsel *evsel) +{ + return &evsel->attr; +} diff --git a/tools/perf/lib/include/perf/evsel.h b/tools/perf/lib/include/perf/evsel.h index ae9f7eeb53a2..4388667f265c 100644 --- a/tools/perf/lib/include/perf/evsel.h +++ b/tools/perf/lib/include/perf/evsel.h @@ -34,5 +34,6 @@ LIBPERF_API int perf_evsel__enable(struct perf_evsel *evsel); LIBPERF_API int perf_evsel__disable(struct perf_evsel *evsel); LIBPERF_API struct perf_cpu_map *perf_evsel__cpus(struct perf_evsel *evsel); LIBPERF_API struct perf_thread_map *perf_evsel__threads(struct perf_evsel *evsel); +LIBPERF_API struct perf_event_attr *perf_evsel__attr(struct perf_evsel *evsel); #endif /* __LIBPERF_EVSEL_H */ diff --git a/tools/perf/lib/libperf.map b/tools/perf/lib/libperf.map index 2068e3d52227..e24d3cec01c1 100644 --- a/tools/perf/lib/libperf.map +++ b/tools/perf/lib/libperf.map @@ -23,6 +23,7 @@ LIBPERF_0.0.1 { perf_evsel__read; perf_evsel__cpus; perf_evsel__threads; + perf_evsel__attr; perf_evlist__new; perf_evlist__delete; perf_evlist__open;