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);
47 #define perf_evlist__add_attrs_array(evlist, array) \
48 perf_evlist__add_attrs(evlist, array, ARRAY_SIZE(array))
50 void perf_evlist__id_add(struct perf_evlist *evlist, struct perf_evsel *evsel,
51 int cpu, int thread, u64 id);
53 int perf_evlist__alloc_pollfd(struct perf_evlist *evlist);
54 void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd);
56 struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id);
58 union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx);
60 int perf_evlist__open(struct perf_evlist *evlist, bool group);
62 int perf_evlist__alloc_mmap(struct perf_evlist *evlist);
63 int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite);
64 void perf_evlist__munmap(struct perf_evlist *evlist);
66 void perf_evlist__disable(struct perf_evlist *evlist);
67 void perf_evlist__enable(struct perf_evlist *evlist);
69 void perf_evlist__set_selected(struct perf_evlist *evlist,
70 struct perf_evsel *evsel);
72 static inline void perf_evlist__set_maps(struct perf_evlist *evlist,
74 struct thread_map *threads)
77 evlist->threads = threads;
80 int perf_evlist__create_maps(struct perf_evlist *evlist, pid_t target_pid,
81 pid_t target_tid, const char *cpu_list);
82 void perf_evlist__delete_maps(struct perf_evlist *evlist);
83 int perf_evlist__set_filters(struct perf_evlist *evlist);
85 u64 perf_evlist__sample_type(const struct perf_evlist *evlist);
86 bool perf_evlist__sample_id_all(const const struct perf_evlist *evlist);
88 bool perf_evlist__valid_sample_type(const struct perf_evlist *evlist);
89 bool perf_evlist__valid_sample_id_all(const struct perf_evlist *evlist);
90 #endif /* __PERF_EVLIST_H */