13ce311afSJiri Olsa /* SPDX-License-Identifier: GPL-2.0 */ 23ce311afSJiri Olsa #ifndef __LIBPERF_EVSEL_H 33ce311afSJiri Olsa #define __LIBPERF_EVSEL_H 43ce311afSJiri Olsa 53ce311afSJiri Olsa #include <stdint.h> 63ce311afSJiri Olsa #include <perf/core.h> 73ce311afSJiri Olsa 83ce311afSJiri Olsa struct perf_evsel; 93ce311afSJiri Olsa struct perf_event_attr; 103ce311afSJiri Olsa struct perf_cpu_map; 113ce311afSJiri Olsa struct perf_thread_map; 123ce311afSJiri Olsa 133ce311afSJiri Olsa struct perf_counts_values { 143ce311afSJiri Olsa union { 153ce311afSJiri Olsa struct { 163ce311afSJiri Olsa uint64_t val; 173ce311afSJiri Olsa uint64_t ena; 183ce311afSJiri Olsa uint64_t run; 193ce311afSJiri Olsa }; 203ce311afSJiri Olsa uint64_t values[3]; 213ce311afSJiri Olsa }; 223ce311afSJiri Olsa }; 233ce311afSJiri Olsa 243ce311afSJiri Olsa LIBPERF_API struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr); 253ce311afSJiri Olsa LIBPERF_API void perf_evsel__delete(struct perf_evsel *evsel); 263ce311afSJiri Olsa LIBPERF_API int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus, 273ce311afSJiri Olsa struct perf_thread_map *threads); 283ce311afSJiri Olsa LIBPERF_API void perf_evsel__close(struct perf_evsel *evsel); 293ce311afSJiri Olsa LIBPERF_API void perf_evsel__close_cpu(struct perf_evsel *evsel, int cpu); 30*6cd70754SRob Herring LIBPERF_API int perf_evsel__mmap(struct perf_evsel *evsel, int pages); 31*6cd70754SRob Herring LIBPERF_API void perf_evsel__munmap(struct perf_evsel *evsel); 32*6cd70754SRob Herring LIBPERF_API void *perf_evsel__mmap_base(struct perf_evsel *evsel, int cpu, int thread); 333ce311afSJiri Olsa LIBPERF_API int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread, 343ce311afSJiri Olsa struct perf_counts_values *count); 353ce311afSJiri Olsa LIBPERF_API int perf_evsel__enable(struct perf_evsel *evsel); 363ce311afSJiri Olsa LIBPERF_API int perf_evsel__enable_cpu(struct perf_evsel *evsel, int cpu); 373ce311afSJiri Olsa LIBPERF_API int perf_evsel__disable(struct perf_evsel *evsel); 383ce311afSJiri Olsa LIBPERF_API int perf_evsel__disable_cpu(struct perf_evsel *evsel, int cpu); 393ce311afSJiri Olsa LIBPERF_API struct perf_cpu_map *perf_evsel__cpus(struct perf_evsel *evsel); 403ce311afSJiri Olsa LIBPERF_API struct perf_thread_map *perf_evsel__threads(struct perf_evsel *evsel); 413ce311afSJiri Olsa LIBPERF_API struct perf_event_attr *perf_evsel__attr(struct perf_evsel *evsel); 423ce311afSJiri Olsa 433ce311afSJiri Olsa #endif /* __LIBPERF_EVSEL_H */ 44