perf tools: Introduce perf_target__validate() helper
[deliverable/linux.git] / tools / perf / util / evlist.h
CommitLineData
361c99a6
ACM
1#ifndef __PERF_EVLIST_H
2#define __PERF_EVLIST_H 1
3
4#include <linux/list.h>
50d08e47 5#include <stdio.h>
70db7533 6#include "../perf.h"
04391deb 7#include "event.h"
50d08e47 8#include "util.h"
35b9d88e 9#include <unistd.h>
361c99a6 10
5c581041 11struct pollfd;
f8a95309
ACM
12struct thread_map;
13struct cpu_map;
0f82ebc4 14struct perf_record_opts;
5c581041 15
70db7533
ACM
16#define PERF_EVLIST__HLIST_BITS 8
17#define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
18
361c99a6
ACM
19struct perf_evlist {
20 struct list_head entries;
70db7533 21 struct hlist_head heads[PERF_EVLIST__HLIST_SIZE];
361c99a6 22 int nr_entries;
5c581041 23 int nr_fds;
aece948f 24 int nr_mmaps;
70db7533 25 int mmap_len;
35b9d88e
ACM
26 struct {
27 int cork_fd;
28 pid_t pid;
29 } workload;
7bb41152 30 bool overwrite;
8115d60c 31 union perf_event event_copy;
70db7533 32 struct perf_mmap *mmap;
5c581041 33 struct pollfd *pollfd;
7e2ed097
ACM
34 struct thread_map *threads;
35 struct cpu_map *cpus;
81cce8de 36 struct perf_evsel *selected;
361c99a6
ACM
37};
38
ee29be62
ACM
39struct perf_evsel_str_handler {
40 const char *name;
41 void *handler;
42};
43
361c99a6
ACM
44struct perf_evsel;
45
7e2ed097
ACM
46struct perf_evlist *perf_evlist__new(struct cpu_map *cpus,
47 struct thread_map *threads);
48void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus,
49 struct thread_map *threads);
ef1d1af2 50void perf_evlist__exit(struct perf_evlist *evlist);
361c99a6
ACM
51void perf_evlist__delete(struct perf_evlist *evlist);
52
53void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry);
54int perf_evlist__add_default(struct perf_evlist *evlist);
50d08e47
ACM
55int perf_evlist__add_attrs(struct perf_evlist *evlist,
56 struct perf_event_attr *attrs, size_t nr_attrs);
a8c9ae18
ACM
57int perf_evlist__add_tracepoints(struct perf_evlist *evlist,
58 const char *tracepoints[], size_t nr_tracepoints);
ee29be62
ACM
59int perf_evlist__set_tracepoints_handlers(struct perf_evlist *evlist,
60 const struct perf_evsel_str_handler *assocs,
61 size_t nr_assocs);
50d08e47
ACM
62
63#define perf_evlist__add_attrs_array(evlist, array) \
64 perf_evlist__add_attrs(evlist, array, ARRAY_SIZE(array))
361c99a6 65
a8c9ae18
ACM
66#define perf_evlist__add_tracepoints_array(evlist, array) \
67 perf_evlist__add_tracepoints(evlist, array, ARRAY_SIZE(array))
68
ee29be62
ACM
69#define perf_evlist__set_tracepoints_handlers_array(evlist, array) \
70 perf_evlist__set_tracepoints_handlers(evlist, array, ARRAY_SIZE(array))
71
a91e5431
ACM
72void perf_evlist__id_add(struct perf_evlist *evlist, struct perf_evsel *evsel,
73 int cpu, int thread, u64 id);
3d3b5e95 74
70082dd9 75void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd);
5c581041 76
70db7533
ACM
77struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id);
78
aece948f 79union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx);
04391deb 80
727ab04e
ACM
81int perf_evlist__open(struct perf_evlist *evlist, bool group);
82
0f82ebc4
ACM
83void perf_evlist__config_attrs(struct perf_evlist *evlist,
84 struct perf_record_opts *opts);
85
35b9d88e
ACM
86int perf_evlist__prepare_workload(struct perf_evlist *evlist,
87 struct perf_record_opts *opts,
88 const char *argv[]);
89int perf_evlist__start_workload(struct perf_evlist *evlist);
90
50a682ce
ACM
91int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages,
92 bool overwrite);
7e2ed097
ACM
93void perf_evlist__munmap(struct perf_evlist *evlist);
94
4152ab37 95void perf_evlist__disable(struct perf_evlist *evlist);
764e16a3 96void perf_evlist__enable(struct perf_evlist *evlist);
4152ab37 97
81cce8de
ACM
98void perf_evlist__set_selected(struct perf_evlist *evlist,
99 struct perf_evsel *evsel);
100
7e2ed097
ACM
101static inline void perf_evlist__set_maps(struct perf_evlist *evlist,
102 struct cpu_map *cpus,
103 struct thread_map *threads)
104{
105 evlist->cpus = cpus;
106 evlist->threads = threads;
107}
108
b52956c9
DA
109int perf_evlist__create_maps(struct perf_evlist *evlist, const char *target_pid,
110 const char *tid, uid_t uid, const char *cpu_list);
7e2ed097 111void perf_evlist__delete_maps(struct perf_evlist *evlist);
0a102479 112int perf_evlist__set_filters(struct perf_evlist *evlist);
f8a95309 113
c2a70653
ACM
114u64 perf_evlist__sample_type(const struct perf_evlist *evlist);
115bool perf_evlist__sample_id_all(const const struct perf_evlist *evlist);
81e36bff 116u16 perf_evlist__id_hdr_size(const struct perf_evlist *evlist);
74429964 117
c2a70653
ACM
118bool perf_evlist__valid_sample_type(const struct perf_evlist *evlist);
119bool perf_evlist__valid_sample_id_all(const struct perf_evlist *evlist);
0529bc1f
JO
120
121void perf_evlist__splice_list_tail(struct perf_evlist *evlist,
122 struct list_head *list,
123 int nr_entries);
124
361c99a6 125#endif /* __PERF_EVLIST_H */
This page took 0.235715 seconds and 5 git commands to generate.