1 #ifndef __PERF_EVLIST_H
2 #define __PERF_EVLIST_H 1
4 #include <linux/list.h>
13 struct perf_record_opts;
15 #define PERF_EVLIST__HLIST_BITS 8
16 #define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
19 struct list_head entries;
20 struct hlist_head heads[PERF_EVLIST__HLIST_SIZE];
26 union perf_event event_copy;
27 struct perf_mmap *mmap;
28 struct pollfd *pollfd;
29 struct thread_map *threads;
31 struct perf_evsel *selected;
36 struct perf_evlist *perf_evlist__new(struct cpu_map *cpus,
37 struct thread_map *threads);
38 void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus,
39 struct thread_map *threads);
40 void perf_evlist__exit(struct perf_evlist *evlist);
41 void perf_evlist__delete(struct perf_evlist *evlist);
43 void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry);
44 int perf_evlist__add_default(struct perf_evlist *evlist);
45 int perf_evlist__add_attrs(struct perf_evlist *evlist,
46 struct perf_event_attr *attrs, size_t nr_attrs);
47 int perf_evlist__add_tracepoints(struct perf_evlist *evlist,
48 const char *tracepoints[], size_t nr_tracepoints);
50 #define perf_evlist__add_attrs_array(evlist, array) \
51 perf_evlist__add_attrs(evlist, array, ARRAY_SIZE(array))
53 #define perf_evlist__add_tracepoints_array(evlist, array) \
54 perf_evlist__add_tracepoints(evlist, array, ARRAY_SIZE(array))
56 void perf_evlist__id_add(struct perf_evlist *evlist, struct perf_evsel *evsel,
57 int cpu, int thread, u64 id);
59 int perf_evlist__alloc_pollfd(struct perf_evlist *evlist);
60 void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd);
62 struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id);
64 union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx);
66 int perf_evlist__open(struct perf_evlist *evlist, bool group);
68 void perf_evlist__config_attrs(struct perf_evlist *evlist,
69 struct perf_record_opts *opts);
71 int perf_evlist__alloc_mmap(struct perf_evlist *evlist);
72 int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite);
73 void perf_evlist__munmap(struct perf_evlist *evlist);
75 void perf_evlist__disable(struct perf_evlist *evlist);
76 void perf_evlist__enable(struct perf_evlist *evlist);
78 void perf_evlist__set_selected(struct perf_evlist *evlist,
79 struct perf_evsel *evsel);
81 static inline void perf_evlist__set_maps(struct perf_evlist *evlist,
83 struct thread_map *threads)
86 evlist->threads = threads;
89 int perf_evlist__create_maps(struct perf_evlist *evlist, pid_t target_pid,
90 pid_t target_tid, const char *cpu_list);
91 void perf_evlist__delete_maps(struct perf_evlist *evlist);
92 int perf_evlist__set_filters(struct perf_evlist *evlist);
94 u64 perf_evlist__sample_type(const struct perf_evlist *evlist);
95 bool perf_evlist__sample_id_all(const const struct perf_evlist *evlist);
97 bool perf_evlist__valid_sample_type(const struct perf_evlist *evlist);
98 bool perf_evlist__valid_sample_id_all(const struct perf_evlist *evlist);
99 #endif /* __PERF_EVLIST_H */