1 #ifndef __PERF_EVLIST_H
2 #define __PERF_EVLIST_H 1
4 #include <linux/list.h>
14 struct perf_record_opts
;
16 #define PERF_EVLIST__HLIST_BITS 8
17 #define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
20 struct list_head entries
;
21 struct hlist_head heads
[PERF_EVLIST__HLIST_SIZE
];
31 union perf_event event_copy
;
32 struct perf_mmap
*mmap
;
33 struct pollfd
*pollfd
;
34 struct thread_map
*threads
;
36 struct perf_evsel
*selected
;
39 struct perf_evsel_str_handler
{
46 struct perf_evlist
*perf_evlist__new(struct cpu_map
*cpus
,
47 struct thread_map
*threads
);
48 void perf_evlist__init(struct perf_evlist
*evlist
, struct cpu_map
*cpus
,
49 struct thread_map
*threads
);
50 void perf_evlist__exit(struct perf_evlist
*evlist
);
51 void perf_evlist__delete(struct perf_evlist
*evlist
);
53 void perf_evlist__add(struct perf_evlist
*evlist
, struct perf_evsel
*entry
);
54 int perf_evlist__add_default(struct perf_evlist
*evlist
);
55 int perf_evlist__add_attrs(struct perf_evlist
*evlist
,
56 struct perf_event_attr
*attrs
, size_t nr_attrs
);
57 int __perf_evlist__add_default_attrs(struct perf_evlist
*evlist
,
58 struct perf_event_attr
*attrs
, size_t nr_attrs
);
59 int perf_evlist__add_tracepoints(struct perf_evlist
*evlist
,
60 const char *tracepoints
[], size_t nr_tracepoints
);
61 int perf_evlist__set_tracepoints_handlers(struct perf_evlist
*evlist
,
62 const struct perf_evsel_str_handler
*assocs
,
65 #define perf_evlist__add_attrs_array(evlist, array) \
66 perf_evlist__add_attrs(evlist, array, ARRAY_SIZE(array))
67 #define perf_evlist__add_default_attrs(evlist, array) \
68 __perf_evlist__add_default_attrs(evlist, array, ARRAY_SIZE(array))
70 #define perf_evlist__add_tracepoints_array(evlist, array) \
71 perf_evlist__add_tracepoints(evlist, array, ARRAY_SIZE(array))
73 #define perf_evlist__set_tracepoints_handlers_array(evlist, array) \
74 perf_evlist__set_tracepoints_handlers(evlist, array, ARRAY_SIZE(array))
77 perf_evlist__find_tracepoint_by_id(struct perf_evlist
*evlist
, int id
);
79 void perf_evlist__id_add(struct perf_evlist
*evlist
, struct perf_evsel
*evsel
,
80 int cpu
, int thread
, u64 id
);
82 void perf_evlist__add_pollfd(struct perf_evlist
*evlist
, int fd
);
84 struct perf_evsel
*perf_evlist__id2evsel(struct perf_evlist
*evlist
, u64 id
);
86 union perf_event
*perf_evlist__mmap_read(struct perf_evlist
*self
, int idx
);
88 int perf_evlist__open(struct perf_evlist
*evlist
, bool group
);
90 void perf_evlist__config_attrs(struct perf_evlist
*evlist
,
91 struct perf_record_opts
*opts
);
93 int perf_evlist__prepare_workload(struct perf_evlist
*evlist
,
94 struct perf_record_opts
*opts
,
96 int perf_evlist__start_workload(struct perf_evlist
*evlist
);
98 int perf_evlist__mmap(struct perf_evlist
*evlist
, unsigned int pages
,
100 void perf_evlist__munmap(struct perf_evlist
*evlist
);
102 void perf_evlist__disable(struct perf_evlist
*evlist
);
103 void perf_evlist__enable(struct perf_evlist
*evlist
);
105 void perf_evlist__set_selected(struct perf_evlist
*evlist
,
106 struct perf_evsel
*evsel
);
108 static inline void perf_evlist__set_maps(struct perf_evlist
*evlist
,
109 struct cpu_map
*cpus
,
110 struct thread_map
*threads
)
113 evlist
->threads
= threads
;
116 int perf_evlist__create_maps(struct perf_evlist
*evlist
,
117 struct perf_target
*target
);
118 void perf_evlist__delete_maps(struct perf_evlist
*evlist
);
119 int perf_evlist__set_filters(struct perf_evlist
*evlist
);
121 u64
perf_evlist__sample_type(const struct perf_evlist
*evlist
);
122 bool perf_evlist__sample_id_all(const const struct perf_evlist
*evlist
);
123 u16
perf_evlist__id_hdr_size(const struct perf_evlist
*evlist
);
125 int perf_evlist__parse_sample(struct perf_evlist
*evlist
, union perf_event
*event
,
126 struct perf_sample
*sample
, bool swapped
);
128 bool perf_evlist__valid_sample_type(const struct perf_evlist
*evlist
);
129 bool perf_evlist__valid_sample_id_all(const struct perf_evlist
*evlist
);
131 void perf_evlist__splice_list_tail(struct perf_evlist
*evlist
,
132 struct list_head
*list
,
135 #endif /* __PERF_EVLIST_H */