2706ae40c8b38c91f9d8e97674b66439664c0606
[linux-2.6.git] / tools / perf / util / evlist.h
1 #ifndef __PERF_EVLIST_H
2 #define __PERF_EVLIST_H 1
3
4 #include <linux/list.h>
5 #include "../perf.h"
6 #include "event.h"
7
8 struct pollfd;
9
10 #define PERF_EVLIST__HLIST_BITS 8
11 #define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
12
13 struct perf_evlist {
14         struct list_head entries;
15         struct hlist_head heads[PERF_EVLIST__HLIST_SIZE];
16         int              nr_entries;
17         int              nr_fds;
18         int              mmap_len;
19         bool             overwrite;
20         event_t          event_copy;
21         struct perf_mmap *mmap;
22         struct pollfd    *pollfd;
23 };
24
25 struct perf_evsel;
26
27 struct perf_evlist *perf_evlist__new(void);
28 void perf_evlist__init(struct perf_evlist *evlist);
29 void perf_evlist__exit(struct perf_evlist *evlist);
30 void perf_evlist__delete(struct perf_evlist *evlist);
31
32 void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry);
33 int perf_evlist__add_default(struct perf_evlist *evlist);
34
35 int perf_evlist__alloc_pollfd(struct perf_evlist *evlist, int ncpus, int nthreads);
36 void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd);
37
38 struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id);
39
40 event_t *perf_evlist__read_on_cpu(struct perf_evlist *self, int cpu);
41
42 #endif /* __PERF_EVLIST_H */