perf evlist: Steal mmap reading routine from 'perf top'
[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         event_t          event_copy;
20         struct perf_mmap *mmap;
21         struct pollfd    *pollfd;
22 };
23
24 struct perf_evsel;
25
26 struct perf_evlist *perf_evlist__new(void);
27 void perf_evlist__delete(struct perf_evlist *evlist);
28
29 void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry);
30 int perf_evlist__add_default(struct perf_evlist *evlist);
31
32 int perf_evlist__alloc_pollfd(struct perf_evlist *evlist, int ncpus, int nthreads);
33 void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd);
34
35 struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id);
36
37 event_t *perf_evlist__read_on_cpu(struct perf_evlist *self, int cpu);
38
39 #endif /* __PERF_EVLIST_H */