This source file includes following definitions.
- perf_evlist__first
- perf_evlist__last
1
2 #ifndef __LIBPERF_INTERNAL_EVLIST_H
3 #define __LIBPERF_INTERNAL_EVLIST_H
4
5 #include <linux/list.h>
6 #include <api/fd/array.h>
7 #include <internal/evsel.h>
8
9 #define PERF_EVLIST__HLIST_BITS 8
10 #define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
11
12 struct perf_cpu_map;
13 struct perf_thread_map;
14
15 struct perf_evlist {
16 struct list_head entries;
17 int nr_entries;
18 bool has_user_cpus;
19 struct perf_cpu_map *cpus;
20 struct perf_thread_map *threads;
21 int nr_mmaps;
22 size_t mmap_len;
23 struct fdarray pollfd;
24 struct hlist_head heads[PERF_EVLIST__HLIST_SIZE];
25 };
26
27 int perf_evlist__alloc_pollfd(struct perf_evlist *evlist);
28 int perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd,
29 void *ptr, short revent);
30
31
32
33
34
35
36 #define __perf_evlist__for_each_entry(list, evsel) \
37 list_for_each_entry(evsel, list, node)
38
39
40
41
42
43
44 #define perf_evlist__for_each_entry(evlist, evsel) \
45 __perf_evlist__for_each_entry(&(evlist)->entries, evsel)
46
47
48
49
50
51
52 #define __perf_evlist__for_each_entry_reverse(list, evsel) \
53 list_for_each_entry_reverse(evsel, list, node)
54
55
56
57
58
59
60 #define perf_evlist__for_each_entry_reverse(evlist, evsel) \
61 __perf_evlist__for_each_entry_reverse(&(evlist)->entries, evsel)
62
63 static inline struct perf_evsel *perf_evlist__first(struct perf_evlist *evlist)
64 {
65 return list_entry(evlist->entries.next, struct perf_evsel, node);
66 }
67
68 static inline struct perf_evsel *perf_evlist__last(struct perf_evlist *evlist)
69 {
70 return list_entry(evlist->entries.prev, struct perf_evsel, node);
71 }
72
73 u64 perf_evlist__read_format(struct perf_evlist *evlist);
74
75 void perf_evlist__id_add(struct perf_evlist *evlist,
76 struct perf_evsel *evsel,
77 int cpu, int thread, u64 id);
78
79 int perf_evlist__id_add_fd(struct perf_evlist *evlist,
80 struct perf_evsel *evsel,
81 int cpu, int thread, int fd);
82
83 #endif