1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __LIBPERF_EVLIST_H
3 #define __LIBPERF_EVLIST_H
4 
5 #include <perf/core.h>
6 #include <stdbool.h>
7 
8 struct perf_evlist;
9 struct perf_evsel;
10 struct perf_cpu_map;
11 struct perf_thread_map;
12 
13 LIBPERF_API void perf_evlist__add(struct perf_evlist *evlist,
14 				  struct perf_evsel *evsel);
15 LIBPERF_API void perf_evlist__remove(struct perf_evlist *evlist,
16 				     struct perf_evsel *evsel);
17 LIBPERF_API struct perf_evlist *perf_evlist__new(void);
18 LIBPERF_API void perf_evlist__delete(struct perf_evlist *evlist);
19 LIBPERF_API struct perf_evsel* perf_evlist__next(struct perf_evlist *evlist,
20 						 struct perf_evsel *evsel);
21 LIBPERF_API int perf_evlist__open(struct perf_evlist *evlist);
22 LIBPERF_API void perf_evlist__close(struct perf_evlist *evlist);
23 LIBPERF_API void perf_evlist__enable(struct perf_evlist *evlist);
24 LIBPERF_API void perf_evlist__disable(struct perf_evlist *evlist);
25 
26 #define perf_evlist__for_each_evsel(evlist, pos)	\
27 	for ((pos) = perf_evlist__next((evlist), NULL);	\
28 	     (pos) != NULL;				\
29 	     (pos) = perf_evlist__next((evlist), (pos)))
30 
31 LIBPERF_API void perf_evlist__set_maps(struct perf_evlist *evlist,
32 				       struct perf_cpu_map *cpus,
33 				       struct perf_thread_map *threads);
34 LIBPERF_API int perf_evlist__poll(struct perf_evlist *evlist, int timeout);
35 LIBPERF_API int perf_evlist__filter_pollfd(struct perf_evlist *evlist,
36 					   short revents_and_mask);
37 
38 LIBPERF_API int perf_evlist__mmap(struct perf_evlist *evlist, int pages);
39 LIBPERF_API void perf_evlist__munmap(struct perf_evlist *evlist);
40 
41 LIBPERF_API struct perf_mmap *perf_evlist__next_mmap(struct perf_evlist *evlist,
42 						     struct perf_mmap *map,
43 						     bool overwrite);
44 #define perf_evlist__for_each_mmap(evlist, pos, overwrite)		\
45 	for ((pos) = perf_evlist__next_mmap((evlist), NULL, overwrite);	\
46 	     (pos) != NULL;						\
47 	     (pos) = perf_evlist__next_mmap((evlist), (pos), overwrite))
48 
49 LIBPERF_API void perf_evlist__set_leader(struct perf_evlist *evlist);
50 #endif /* __LIBPERF_EVLIST_H */
51