xref: /openbmc/linux/tools/lib/perf/include/perf/evsel.h (revision 3ce311af)
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);
303ce311afSJiri Olsa LIBPERF_API int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread,
313ce311afSJiri Olsa 				 struct perf_counts_values *count);
323ce311afSJiri Olsa LIBPERF_API int perf_evsel__enable(struct perf_evsel *evsel);
333ce311afSJiri Olsa LIBPERF_API int perf_evsel__enable_cpu(struct perf_evsel *evsel, int cpu);
343ce311afSJiri Olsa LIBPERF_API int perf_evsel__disable(struct perf_evsel *evsel);
353ce311afSJiri Olsa LIBPERF_API int perf_evsel__disable_cpu(struct perf_evsel *evsel, int cpu);
363ce311afSJiri Olsa LIBPERF_API struct perf_cpu_map *perf_evsel__cpus(struct perf_evsel *evsel);
373ce311afSJiri Olsa LIBPERF_API struct perf_thread_map *perf_evsel__threads(struct perf_evsel *evsel);
383ce311afSJiri Olsa LIBPERF_API struct perf_event_attr *perf_evsel__attr(struct perf_evsel *evsel);
393ce311afSJiri Olsa 
403ce311afSJiri Olsa #endif /* __LIBPERF_EVSEL_H */
41