1 /* SPDX-License-Identifier: GPL-2.0 */ 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 struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr); 25 LIBPERF_API void perf_evsel__delete(struct perf_evsel *evsel); 26 LIBPERF_API int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus, 27 struct perf_thread_map *threads); 28 LIBPERF_API void perf_evsel__close(struct perf_evsel *evsel); 29 LIBPERF_API void perf_evsel__close_cpu(struct perf_evsel *evsel, int cpu); 30 LIBPERF_API int perf_evsel__mmap(struct perf_evsel *evsel, int pages); 31 LIBPERF_API void perf_evsel__munmap(struct perf_evsel *evsel); 32 LIBPERF_API void *perf_evsel__mmap_base(struct perf_evsel *evsel, int cpu, int thread); 33 LIBPERF_API int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread, 34 struct perf_counts_values *count); 35 LIBPERF_API int perf_evsel__enable(struct perf_evsel *evsel); 36 LIBPERF_API int perf_evsel__enable_cpu(struct perf_evsel *evsel, int cpu); 37 LIBPERF_API int perf_evsel__disable(struct perf_evsel *evsel); 38 LIBPERF_API int perf_evsel__disable_cpu(struct perf_evsel *evsel, int cpu); 39 LIBPERF_API struct perf_cpu_map *perf_evsel__cpus(struct perf_evsel *evsel); 40 LIBPERF_API struct perf_thread_map *perf_evsel__threads(struct perf_evsel *evsel); 41 LIBPERF_API struct perf_event_attr *perf_evsel__attr(struct perf_evsel *evsel); 42 43 #endif /* __LIBPERF_EVSEL_H */ 44