1 #ifndef __PERF_EVLIST_H
2 #define __PERF_EVLIST_H 1
3
4 /* ANDROID_CHANGE_BEGIN */
5 #if 0
6 #include <linux/list.h>
7 #else
8 #include "include/linux/list.h"
9 #endif
10 /* ANDROID_CHANGE_END */
11 #include "../perf.h"
12 #include "event.h"
13
14 struct pollfd;
15 struct thread_map;
16 struct cpu_map;
17
18 #define PERF_EVLIST__HLIST_BITS 8
19 #define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
20
21 struct perf_evlist {
22 struct list_head entries;
23 struct hlist_head heads[PERF_EVLIST__HLIST_SIZE];
24 int nr_entries;
25 int nr_fds;
26 int nr_mmaps;
27 int mmap_len;
28 bool overwrite;
29 union perf_event event_copy;
30 struct perf_mmap *mmap;
31 struct pollfd *pollfd;
32 struct thread_map *threads;
33 struct cpu_map *cpus;
34 };
35
36 struct perf_evsel;
37
38 struct perf_evlist *perf_evlist__new(struct cpu_map *cpus,
39 struct thread_map *threads);
40 void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus,
41 struct thread_map *threads);
42 void perf_evlist__exit(struct perf_evlist *evlist);
43 void perf_evlist__delete(struct perf_evlist *evlist);
44
45 void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry);
46 int perf_evlist__add_default(struct perf_evlist *evlist);
47
48 void perf_evlist__id_add(struct perf_evlist *evlist, struct perf_evsel *evsel,
49 int cpu, int thread, u64 id);
50
51 int perf_evlist__alloc_pollfd(struct perf_evlist *evlist);
52 void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd);
53
54 struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id);
55
56 union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx);
57
58 int perf_evlist__alloc_mmap(struct perf_evlist *evlist);
59 int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite);
60 void perf_evlist__munmap(struct perf_evlist *evlist);
61
perf_evlist__set_maps(struct perf_evlist * evlist,struct cpu_map * cpus,struct thread_map * threads)62 static inline void perf_evlist__set_maps(struct perf_evlist *evlist,
63 struct cpu_map *cpus,
64 struct thread_map *threads)
65 {
66 evlist->cpus = cpus;
67 evlist->threads = threads;
68 }
69
70 int perf_evlist__create_maps(struct perf_evlist *evlist, pid_t target_pid,
71 pid_t target_tid, const char *cpu_list);
72 void perf_evlist__delete_maps(struct perf_evlist *evlist);
73 int perf_evlist__set_filters(struct perf_evlist *evlist);
74
75 u64 perf_evlist__sample_type(const struct perf_evlist *evlist);
76 bool perf_evlist__sample_id_all(const const struct perf_evlist *evlist);
77
78 bool perf_evlist__valid_sample_type(const struct perf_evlist *evlist);
79 bool perf_evlist__valid_sample_id_all(const struct perf_evlist *evlist);
80 #endif /* __PERF_EVLIST_H */
81