Arnaldo Carvalho de Melo | 361c99a | 2011-01-11 20:56:53 -0200 | [diff] [blame] | 1 | #ifndef __PERF_EVLIST_H |
| 2 | #define __PERF_EVLIST_H 1 |
| 3 | |
| 4 | #include <linux/list.h> |
Arnaldo Carvalho de Melo | 70db753 | 2011-01-12 22:39:13 -0200 | [diff] [blame] | 5 | #include "../perf.h" |
Arnaldo Carvalho de Melo | 04391de | 2011-01-15 10:40:59 -0200 | [diff] [blame] | 6 | #include "event.h" |
Arnaldo Carvalho de Melo | 361c99a | 2011-01-11 20:56:53 -0200 | [diff] [blame] | 7 | |
Arnaldo Carvalho de Melo | 5c581041 | 2011-01-11 22:30:02 -0200 | [diff] [blame] | 8 | struct pollfd; |
Arnaldo Carvalho de Melo | f8a9530 | 2011-01-30 10:46:46 -0200 | [diff] [blame] | 9 | struct thread_map; |
| 10 | struct cpu_map; |
Arnaldo Carvalho de Melo | 5c581041 | 2011-01-11 22:30:02 -0200 | [diff] [blame] | 11 | |
Arnaldo Carvalho de Melo | 70db753 | 2011-01-12 22:39:13 -0200 | [diff] [blame] | 12 | #define PERF_EVLIST__HLIST_BITS 8 |
| 13 | #define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS) |
| 14 | |
Arnaldo Carvalho de Melo | 361c99a | 2011-01-11 20:56:53 -0200 | [diff] [blame] | 15 | struct perf_evlist { |
| 16 | struct list_head entries; |
Arnaldo Carvalho de Melo | 70db753 | 2011-01-12 22:39:13 -0200 | [diff] [blame] | 17 | struct hlist_head heads[PERF_EVLIST__HLIST_SIZE]; |
Arnaldo Carvalho de Melo | 361c99a | 2011-01-11 20:56:53 -0200 | [diff] [blame] | 18 | int nr_entries; |
Arnaldo Carvalho de Melo | 5c581041 | 2011-01-11 22:30:02 -0200 | [diff] [blame] | 19 | int nr_fds; |
Arnaldo Carvalho de Melo | aece948 | 2011-05-15 09:39:00 -0300 | [diff] [blame] | 20 | int nr_mmaps; |
Arnaldo Carvalho de Melo | 70db753 | 2011-01-12 22:39:13 -0200 | [diff] [blame] | 21 | int mmap_len; |
Arnaldo Carvalho de Melo | 7bb4115 | 2011-01-29 09:08:13 -0200 | [diff] [blame] | 22 | bool overwrite; |
Arnaldo Carvalho de Melo | 8115d60 | 2011-01-29 14:01:45 -0200 | [diff] [blame] | 23 | union perf_event event_copy; |
Arnaldo Carvalho de Melo | 70db753 | 2011-01-12 22:39:13 -0200 | [diff] [blame] | 24 | struct perf_mmap *mmap; |
Arnaldo Carvalho de Melo | 5c581041 | 2011-01-11 22:30:02 -0200 | [diff] [blame] | 25 | struct pollfd *pollfd; |
Arnaldo Carvalho de Melo | 7e2ed09 | 2011-01-30 11:59:43 -0200 | [diff] [blame] | 26 | struct thread_map *threads; |
| 27 | struct cpu_map *cpus; |
Arnaldo Carvalho de Melo | 361c99a | 2011-01-11 20:56:53 -0200 | [diff] [blame] | 28 | }; |
| 29 | |
| 30 | struct perf_evsel; |
| 31 | |
Arnaldo Carvalho de Melo | 7e2ed09 | 2011-01-30 11:59:43 -0200 | [diff] [blame] | 32 | struct perf_evlist *perf_evlist__new(struct cpu_map *cpus, |
| 33 | struct thread_map *threads); |
| 34 | void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus, |
| 35 | struct thread_map *threads); |
Arnaldo Carvalho de Melo | ef1d1af | 2011-01-18 21:41:45 -0200 | [diff] [blame] | 36 | void perf_evlist__exit(struct perf_evlist *evlist); |
Arnaldo Carvalho de Melo | 361c99a | 2011-01-11 20:56:53 -0200 | [diff] [blame] | 37 | void perf_evlist__delete(struct perf_evlist *evlist); |
| 38 | |
| 39 | void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry); |
| 40 | int perf_evlist__add_default(struct perf_evlist *evlist); |
| 41 | |
Arnaldo Carvalho de Melo | a91e543 | 2011-03-10 11:15:54 -0300 | [diff] [blame] | 42 | void perf_evlist__id_add(struct perf_evlist *evlist, struct perf_evsel *evsel, |
| 43 | int cpu, int thread, u64 id); |
Arnaldo Carvalho de Melo | 3d3b5e9 | 2011-03-04 22:29:39 -0300 | [diff] [blame] | 44 | |
Arnaldo Carvalho de Melo | 7e2ed09 | 2011-01-30 11:59:43 -0200 | [diff] [blame] | 45 | int perf_evlist__alloc_pollfd(struct perf_evlist *evlist); |
Arnaldo Carvalho de Melo | 70082dd | 2011-01-12 17:03:24 -0200 | [diff] [blame] | 46 | void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd); |
Arnaldo Carvalho de Melo | 5c581041 | 2011-01-11 22:30:02 -0200 | [diff] [blame] | 47 | |
Arnaldo Carvalho de Melo | 70db753 | 2011-01-12 22:39:13 -0200 | [diff] [blame] | 48 | struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id); |
| 49 | |
Arnaldo Carvalho de Melo | aece948 | 2011-05-15 09:39:00 -0300 | [diff] [blame] | 50 | union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx); |
Arnaldo Carvalho de Melo | 04391de | 2011-01-15 10:40:59 -0200 | [diff] [blame] | 51 | |
Arnaldo Carvalho de Melo | 7e2ed09 | 2011-01-30 11:59:43 -0200 | [diff] [blame] | 52 | int perf_evlist__alloc_mmap(struct perf_evlist *evlist); |
| 53 | int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite); |
| 54 | void perf_evlist__munmap(struct perf_evlist *evlist); |
| 55 | |
Arnaldo Carvalho de Melo | 4152ab3 | 2011-07-25 11:06:19 -0300 | [diff] [blame^] | 56 | void perf_evlist__disable(struct perf_evlist *evlist); |
| 57 | |
Arnaldo Carvalho de Melo | 7e2ed09 | 2011-01-30 11:59:43 -0200 | [diff] [blame] | 58 | static inline void perf_evlist__set_maps(struct perf_evlist *evlist, |
| 59 | struct cpu_map *cpus, |
| 60 | struct thread_map *threads) |
| 61 | { |
| 62 | evlist->cpus = cpus; |
| 63 | evlist->threads = threads; |
| 64 | } |
| 65 | |
| 66 | int perf_evlist__create_maps(struct perf_evlist *evlist, pid_t target_pid, |
| 67 | pid_t target_tid, const char *cpu_list); |
| 68 | void perf_evlist__delete_maps(struct perf_evlist *evlist); |
Frederic Weisbecker | 0a10247 | 2011-02-26 04:51:54 +0100 | [diff] [blame] | 69 | int perf_evlist__set_filters(struct perf_evlist *evlist); |
Arnaldo Carvalho de Melo | f8a9530 | 2011-01-30 10:46:46 -0200 | [diff] [blame] | 70 | |
Arnaldo Carvalho de Melo | c2a7065 | 2011-06-02 11:04:54 -0300 | [diff] [blame] | 71 | u64 perf_evlist__sample_type(const struct perf_evlist *evlist); |
| 72 | bool perf_evlist__sample_id_all(const const struct perf_evlist *evlist); |
Frederic Weisbecker | 7442996 | 2011-05-21 17:49:00 +0200 | [diff] [blame] | 73 | |
Arnaldo Carvalho de Melo | c2a7065 | 2011-06-02 11:04:54 -0300 | [diff] [blame] | 74 | bool perf_evlist__valid_sample_type(const struct perf_evlist *evlist); |
| 75 | bool perf_evlist__valid_sample_id_all(const struct perf_evlist *evlist); |
Arnaldo Carvalho de Melo | 361c99a | 2011-01-11 20:56:53 -0200 | [diff] [blame] | 76 | #endif /* __PERF_EVLIST_H */ |