1 #ifndef __PERF_EVLIST_H
2 #define __PERF_EVLIST_H 1
4 #include <linux/list.h>
14 #define PERF_EVLIST__HLIST_BITS 8
15 #define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
18 struct list_head entries;
19 struct hlist_head heads[PERF_EVLIST__HLIST_SIZE];
25 union perf_event event_copy;
26 struct perf_mmap *mmap;
27 struct pollfd *pollfd;
28 struct thread_map *threads;
30 struct perf_evsel *selected;
35 struct perf_evlist *perf_evlist__new(struct cpu_map *cpus,
36 struct thread_map *threads);
37 void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus,
38 struct thread_map *threads);
39 void perf_evlist__exit(struct perf_evlist *evlist);
40 void perf_evlist__delete(struct perf_evlist *evlist);
42 void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry);
43 int perf_evlist__add_default(struct perf_evlist *evlist);
44 int perf_evlist__add_attrs(struct perf_evlist *evlist,
45 struct perf_event_attr *attrs, size_t nr_attrs);
46 int perf_evlist__add_tracepoints(struct perf_evlist *evlist,
47 const char *tracepoints[], size_t nr_tracepoints);
49 #define perf_evlist__add_attrs_array(evlist, array) \
50 perf_evlist__add_attrs(evlist, array, ARRAY_SIZE(array))
52 #define perf_evlist__add_tracepoints_array(evlist, array) \
53 perf_evlist__add_tracepoints(evlist, array, ARRAY_SIZE(array))
55 void perf_evlist__id_add(struct perf_evlist *evlist, struct perf_evsel *evsel,
56 int cpu, int thread, u64 id);
58 int perf_evlist__alloc_pollfd(struct perf_evlist *evlist);
59 void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd);
61 struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id);
63 union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx);
65 int perf_evlist__open(struct perf_evlist *evlist, bool group);
67 int perf_evlist__alloc_mmap(struct perf_evlist *evlist);
68 int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite);
69 void perf_evlist__munmap(struct perf_evlist *evlist);
71 void perf_evlist__disable(struct perf_evlist *evlist);
72 void perf_evlist__enable(struct perf_evlist *evlist);
74 void perf_evlist__set_selected(struct perf_evlist *evlist,
75 struct perf_evsel *evsel);
77 static inline void perf_evlist__set_maps(struct perf_evlist *evlist,
79 struct thread_map *threads)
82 evlist->threads = threads;
85 int perf_evlist__create_maps(struct perf_evlist *evlist, pid_t target_pid,
86 pid_t target_tid, const char *cpu_list);
87 void perf_evlist__delete_maps(struct perf_evlist *evlist);
88 int perf_evlist__set_filters(struct perf_evlist *evlist);
90 u64 perf_evlist__sample_type(const struct perf_evlist *evlist);
91 bool perf_evlist__sample_id_all(const const struct perf_evlist *evlist);
93 bool perf_evlist__valid_sample_type(const struct perf_evlist *evlist);
94 bool perf_evlist__valid_sample_id_all(const struct perf_evlist *evlist);
95 #endif /* __PERF_EVLIST_H */