libperf: Adopt perf_evlist__enable()/disable() functions from perf
authorJiri Olsa <jolsa@kernel.org>
Sun, 21 Jul 2019 11:24:56 +0000 (13:24 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 29 Jul 2019 21:34:46 +0000 (18:34 -0300)
Adopt the following functions from tools/perf:

  perf_evlist__enable()
  perf_evlist__disable()

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190721112506.12306-70-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/lib/evlist.c
tools/perf/lib/include/perf/evlist.h
tools/perf/lib/libperf.map

index 5dda96b1d4da7d51d1e2825d450f98370c4d813a..f4dc9a20833261938c0cb7b33971afc2e5d8054c 100644 (file)
@@ -141,3 +141,19 @@ void perf_evlist__close(struct perf_evlist *evlist)
        perf_evlist__for_each_entry_reverse(evlist, evsel)
                perf_evsel__close(evsel);
 }
+
+void perf_evlist__enable(struct perf_evlist *evlist)
+{
+       struct perf_evsel *evsel;
+
+       perf_evlist__for_each_entry(evlist, evsel)
+               perf_evsel__enable(evsel);
+}
+
+void perf_evlist__disable(struct perf_evlist *evlist)
+{
+       struct perf_evsel *evsel;
+
+       perf_evlist__for_each_entry(evlist, evsel)
+               perf_evsel__disable(evsel);
+}
index 6d3dda74354108703e323aea3eaf04729a6bf2a8..38365f8f3fbac1889f221f528ac2c179f2c8630a 100644 (file)
@@ -20,6 +20,8 @@ LIBPERF_API struct perf_evsel* perf_evlist__next(struct perf_evlist *evlist,
                                                 struct perf_evsel *evsel);
 LIBPERF_API int perf_evlist__open(struct perf_evlist *evlist);
 LIBPERF_API void perf_evlist__close(struct perf_evlist *evlist);
+LIBPERF_API void perf_evlist__enable(struct perf_evlist *evlist);
+LIBPERF_API void perf_evlist__disable(struct perf_evlist *evlist);
 
 #define perf_evlist__for_each_evsel(evlist, pos)       \
        for ((pos) = perf_evlist__next((evlist), NULL); \
index 4f966ddd5e53cbe85b43f91f39d05d0d278ae0fd..2068e3d52227fab689c907d9ddaaa03f7fce197e 100644 (file)
@@ -27,6 +27,8 @@ LIBPERF_0.0.1 {
                perf_evlist__delete;
                perf_evlist__open;
                perf_evlist__close;
+               perf_evlist__enable;
+               perf_evlist__disable;
                perf_evlist__init;
                perf_evlist__add;
                perf_evlist__remove;