1
2 #ifndef __LIBPERF_EVSEL_H
3 #define __LIBPERF_EVSEL_H
4
5 #include <stdint.h>
6 #include <perf/core.h>
7
8 struct perf_evsel;
9 struct perf_event_attr;
10 struct perf_cpu_map;
11 struct perf_thread_map;
12
13 struct perf_counts_values {
14 union {
15 struct {
16 uint64_t val;
17 uint64_t ena;
18 uint64_t run;
19 };
20 uint64_t values[3];
21 };
22 };
23
24 LIBPERF_API void perf_evsel__init(struct perf_evsel *evsel,
25 struct perf_event_attr *attr);
26 LIBPERF_API struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr);
27 LIBPERF_API void perf_evsel__delete(struct perf_evsel *evsel);
28 LIBPERF_API int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus,
29 struct perf_thread_map *threads);
30 LIBPERF_API void perf_evsel__close(struct perf_evsel *evsel);
31 LIBPERF_API int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread,
32 struct perf_counts_values *count);
33 LIBPERF_API int perf_evsel__enable(struct perf_evsel *evsel);
34 LIBPERF_API int perf_evsel__disable(struct perf_evsel *evsel);
35 LIBPERF_API struct perf_cpu_map *perf_evsel__cpus(struct perf_evsel *evsel);
36 LIBPERF_API struct perf_thread_map *perf_evsel__threads(struct perf_evsel *evsel);
37 LIBPERF_API struct perf_event_attr *perf_evsel__attr(struct perf_evsel *evsel);
38
39 #endif