diff options
author | Jiri Olsa <jolsa@kernel.org> | 2019-07-21 13:24:51 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-07-29 18:34:46 -0300 |
commit | 5c30af92f2b1e9d844e1ae3243e4adcd7753d4c1 (patch) | |
tree | fdc22eab17ef4e38d5c0d2ae39ad9ae169c71c61 /tools/perf/lib/include | |
parent | 88761fa1f1e3fb2df86727ac99f88abf2ac7e00b (diff) | |
download | linux-5c30af92f2b1e9d844e1ae3243e4adcd7753d4c1.tar.gz linux-5c30af92f2b1e9d844e1ae3243e4adcd7753d4c1.tar.bz2 linux-5c30af92f2b1e9d844e1ae3243e4adcd7753d4c1.zip |
libperf: Adopt perf_evsel__read() function from tools/perf
Move the perf_evsel__read() function to libperf as a public interface
together with struct perf_counts_values for returning counter values.
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-65-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/lib/include')
-rw-r--r-- | tools/perf/lib/include/internal/evsel.h | 1 | ||||
-rw-r--r-- | tools/perf/lib/include/perf/evsel.h | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tools/perf/lib/include/internal/evsel.h b/tools/perf/lib/include/internal/evsel.h index 878e2cf41ffc..89bae3720d67 100644 --- a/tools/perf/lib/include/internal/evsel.h +++ b/tools/perf/lib/include/internal/evsel.h @@ -23,5 +23,6 @@ struct perf_evsel { int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads); void perf_evsel__close_fd(struct perf_evsel *evsel); void perf_evsel__free_fd(struct perf_evsel *evsel); +int perf_evsel__read_size(struct perf_evsel *evsel); #endif /* __LIBPERF_INTERNAL_EVSEL_H */ diff --git a/tools/perf/lib/include/perf/evsel.h b/tools/perf/lib/include/perf/evsel.h index aa5c48f822d2..16ae3f873280 100644 --- a/tools/perf/lib/include/perf/evsel.h +++ b/tools/perf/lib/include/perf/evsel.h @@ -2,6 +2,7 @@ #ifndef __LIBPERF_EVSEL_H #define __LIBPERF_EVSEL_H +#include <stdint.h> #include <perf/core.h> struct perf_evsel; @@ -9,6 +10,17 @@ struct perf_event_attr; struct perf_cpu_map; struct perf_thread_map; +struct perf_counts_values { + union { + struct { + uint64_t val; + uint64_t ena; + uint64_t run; + }; + uint64_t values[3]; + }; +}; + LIBPERF_API void perf_evsel__init(struct perf_evsel *evsel, struct perf_event_attr *attr); LIBPERF_API struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr); @@ -16,5 +28,7 @@ LIBPERF_API void perf_evsel__delete(struct perf_evsel *evsel); LIBPERF_API int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus, struct perf_thread_map *threads); LIBPERF_API void perf_evsel__close(struct perf_evsel *evsel); +LIBPERF_API int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread, + struct perf_counts_values *count); #endif /* __LIBPERF_EVSEL_H */ |