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_tracepoints(struct perf_evlist
*evlist
,
58 const char *tracepoints
[], size_t nr_tracepoints
);
59 int perf_evlist__set_tracepoints_handlers(struct perf_evlist
*evlist
,
60 const struct perf_evsel_str_handler
*assocs
,
63 #define perf_evlist__add_attrs_array(evlist, array) \
64 perf_evlist__add_attrs(evlist, array, ARRAY_SIZE(array))
66 #define perf_evlist__add_tracepoints_array(evlist, array) \
67 perf_evlist__add_tracepoints(evlist, array, ARRAY_SIZE(array))
69 #define perf_evlist__set_tracepoints_handlers_array(evlist, array) \
70 perf_evlist__set_tracepoints_handlers(evlist, array, ARRAY_SIZE(array))
72 void perf_evlist__id_add(struct perf_evlist
*evlist
, struct perf_evsel
*evsel
,
73 int cpu
, int thread
, u64 id
);
75 void perf_evlist__add_pollfd(struct perf_evlist
*evlist
, int fd
);
77 struct perf_evsel
*perf_evlist__id2evsel(struct perf_evlist
*evlist
, u64 id
);
79 union perf_event
*perf_evlist__mmap_read(struct perf_evlist
*self
, int idx
);
81 int perf_evlist__open(struct perf_evlist
*evlist
, bool group
);
83 void perf_evlist__config_attrs(struct perf_evlist
*evlist
,
84 struct perf_record_opts
*opts
);
86 int perf_evlist__prepare_workload(struct perf_evlist
*evlist
,
87 struct perf_record_opts
*opts
,
89 int perf_evlist__start_workload(struct perf_evlist
*evlist
);
91 int perf_evlist__mmap(struct perf_evlist
*evlist
, unsigned int pages
,
93 void perf_evlist__munmap(struct perf_evlist
*evlist
);
95 void perf_evlist__disable(struct perf_evlist
*evlist
);
96 void perf_evlist__enable(struct perf_evlist
*evlist
);
98 void perf_evlist__set_selected(struct perf_evlist
*evlist
,
99 struct perf_evsel
*evsel
);
101 static inline void perf_evlist__set_maps(struct perf_evlist
*evlist
,
102 struct cpu_map
*cpus
,
103 struct thread_map
*threads
)
106 evlist
->threads
= threads
;
109 int perf_evlist__create_maps(struct perf_evlist
*evlist
, pid_t target_pid
,
110 pid_t target_tid
, const char *cpu_list
);
111 void perf_evlist__delete_maps(struct perf_evlist
*evlist
);
112 int perf_evlist__set_filters(struct perf_evlist
*evlist
);
114 u64
perf_evlist__sample_type(const struct perf_evlist
*evlist
);
115 bool perf_evlist__sample_id_all(const const struct perf_evlist
*evlist
);
116 u16
perf_evlist__id_hdr_size(const struct perf_evlist
*evlist
);
118 bool perf_evlist__valid_sample_type(const struct perf_evlist
*evlist
);
119 bool perf_evlist__valid_sample_id_all(const struct perf_evlist
*evlist
);
120 #endif /* __PERF_EVLIST_H */