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 | 50d08e4 | 2011-11-04 09:10:59 -0200 | [diff] [blame^] | 5 | #include <stdio.h> |
Arnaldo Carvalho de Melo | 70db753 | 2011-01-12 22:39:13 -0200 | [diff] [blame] | 6 | #include "../perf.h" |
Arnaldo Carvalho de Melo | 04391de | 2011-01-15 10:40:59 -0200 | [diff] [blame] | 7 | #include "event.h" |
Arnaldo Carvalho de Melo | 50d08e4 | 2011-11-04 09:10:59 -0200 | [diff] [blame^] | 8 | #include "util.h" |
Arnaldo Carvalho de Melo | 361c99a | 2011-01-11 20:56:53 -0200 | [diff] [blame] | 9 | |
Arnaldo Carvalho de Melo | 5c581041 | 2011-01-11 22:30:02 -0200 | [diff] [blame] | 10 | struct pollfd; |
Arnaldo Carvalho de Melo | f8a9530 | 2011-01-30 10:46:46 -0200 | [diff] [blame] | 11 | struct thread_map; |
| 12 | struct cpu_map; |
Arnaldo Carvalho de Melo | 5c581041 | 2011-01-11 22:30:02 -0200 | [diff] [blame] | 13 | |
Arnaldo Carvalho de Melo | 70db753 | 2011-01-12 22:39:13 -0200 | [diff] [blame] | 14 | #define PERF_EVLIST__HLIST_BITS 8 |
| 15 | #define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS) |
| 16 | |
Arnaldo Carvalho de Melo | 361c99a | 2011-01-11 20:56:53 -0200 | [diff] [blame] | 17 | struct perf_evlist { |
| 18 | struct list_head entries; |
Arnaldo Carvalho de Melo | 70db753 | 2011-01-12 22:39:13 -0200 | [diff] [blame] | 19 | struct hlist_head heads[PERF_EVLIST__HLIST_SIZE]; |
Arnaldo Carvalho de Melo | 361c99a | 2011-01-11 20:56:53 -0200 | [diff] [blame] | 20 | int nr_entries; |
Arnaldo Carvalho de Melo | 5c581041 | 2011-01-11 22:30:02 -0200 | [diff] [blame] | 21 | int nr_fds; |
Arnaldo Carvalho de Melo | aece948 | 2011-05-15 09:39:00 -0300 | [diff] [blame] | 22 | int nr_mmaps; |
Arnaldo Carvalho de Melo | 70db753 | 2011-01-12 22:39:13 -0200 | [diff] [blame] | 23 | int mmap_len; |
Arnaldo Carvalho de Melo | 7bb4115 | 2011-01-29 09:08:13 -0200 | [diff] [blame] | 24 | bool overwrite; |
Arnaldo Carvalho de Melo | 8115d60 | 2011-01-29 14:01:45 -0200 | [diff] [blame] | 25 | union perf_event event_copy; |
Arnaldo Carvalho de Melo | 70db753 | 2011-01-12 22:39:13 -0200 | [diff] [blame] | 26 | struct perf_mmap *mmap; |
Arnaldo Carvalho de Melo | 5c581041 | 2011-01-11 22:30:02 -0200 | [diff] [blame] | 27 | struct pollfd *pollfd; |
Arnaldo Carvalho de Melo | 7e2ed09 | 2011-01-30 11:59:43 -0200 | [diff] [blame] | 28 | struct thread_map *threads; |
| 29 | struct cpu_map *cpus; |
Arnaldo Carvalho de Melo | 81cce8d | 2011-10-05 19:11:32 -0300 | [diff] [blame] | 30 | struct perf_evsel *selected; |
Arnaldo Carvalho de Melo | 361c99a | 2011-01-11 20:56:53 -0200 | [diff] [blame] | 31 | }; |
| 32 | |
| 33 | struct perf_evsel; |
| 34 | |
Arnaldo Carvalho de Melo | 7e2ed09 | 2011-01-30 11:59:43 -0200 | [diff] [blame] | 35 | struct perf_evlist *perf_evlist__new(struct cpu_map *cpus, |
| 36 | struct thread_map *threads); |
| 37 | void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus, |
| 38 | struct thread_map *threads); |
Arnaldo Carvalho de Melo | ef1d1af | 2011-01-18 21:41:45 -0200 | [diff] [blame] | 39 | void perf_evlist__exit(struct perf_evlist *evlist); |
Arnaldo Carvalho de Melo | 361c99a | 2011-01-11 20:56:53 -0200 | [diff] [blame] | 40 | void perf_evlist__delete(struct perf_evlist *evlist); |
| 41 | |
| 42 | void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry); |
| 43 | int perf_evlist__add_default(struct perf_evlist *evlist); |
Arnaldo Carvalho de Melo | 50d08e4 | 2011-11-04 09:10:59 -0200 | [diff] [blame^] | 44 | int perf_evlist__add_attrs(struct perf_evlist *evlist, |
| 45 | struct perf_event_attr *attrs, size_t nr_attrs); |
| 46 | |
| 47 | #define perf_evlist__add_attrs_array(evlist, array) \ |
| 48 | perf_evlist__add_attrs(evlist, array, ARRAY_SIZE(array)) |
Arnaldo Carvalho de Melo | 361c99a | 2011-01-11 20:56:53 -0200 | [diff] [blame] | 49 | |
Arnaldo Carvalho de Melo | a91e543 | 2011-03-10 11:15:54 -0300 | [diff] [blame] | 50 | void perf_evlist__id_add(struct perf_evlist *evlist, struct perf_evsel *evsel, |
| 51 | int cpu, int thread, u64 id); |
Arnaldo Carvalho de Melo | 3d3b5e9 | 2011-03-04 22:29:39 -0300 | [diff] [blame] | 52 | |
Arnaldo Carvalho de Melo | 7e2ed09 | 2011-01-30 11:59:43 -0200 | [diff] [blame] | 53 | int perf_evlist__alloc_pollfd(struct perf_evlist *evlist); |
Arnaldo Carvalho de Melo | 70082dd | 2011-01-12 17:03:24 -0200 | [diff] [blame] | 54 | 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] | 55 | |
Arnaldo Carvalho de Melo | 70db753 | 2011-01-12 22:39:13 -0200 | [diff] [blame] | 56 | struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id); |
| 57 | |
Arnaldo Carvalho de Melo | aece948 | 2011-05-15 09:39:00 -0300 | [diff] [blame] | 58 | 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] | 59 | |
Arnaldo Carvalho de Melo | 727ab04 | 2011-10-25 10:42:19 -0200 | [diff] [blame] | 60 | int perf_evlist__open(struct perf_evlist *evlist, bool group); |
| 61 | |
Arnaldo Carvalho de Melo | 7e2ed09 | 2011-01-30 11:59:43 -0200 | [diff] [blame] | 62 | int perf_evlist__alloc_mmap(struct perf_evlist *evlist); |
| 63 | int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite); |
| 64 | void perf_evlist__munmap(struct perf_evlist *evlist); |
| 65 | |
Arnaldo Carvalho de Melo | 4152ab3 | 2011-07-25 11:06:19 -0300 | [diff] [blame] | 66 | void perf_evlist__disable(struct perf_evlist *evlist); |
David Ahern | 764e16a3 | 2011-08-25 10:17:55 -0600 | [diff] [blame] | 67 | void perf_evlist__enable(struct perf_evlist *evlist); |
Arnaldo Carvalho de Melo | 4152ab3 | 2011-07-25 11:06:19 -0300 | [diff] [blame] | 68 | |
Arnaldo Carvalho de Melo | 81cce8d | 2011-10-05 19:11:32 -0300 | [diff] [blame] | 69 | void perf_evlist__set_selected(struct perf_evlist *evlist, |
| 70 | struct perf_evsel *evsel); |
| 71 | |
Arnaldo Carvalho de Melo | 7e2ed09 | 2011-01-30 11:59:43 -0200 | [diff] [blame] | 72 | static inline void perf_evlist__set_maps(struct perf_evlist *evlist, |
| 73 | struct cpu_map *cpus, |
| 74 | struct thread_map *threads) |
| 75 | { |
| 76 | evlist->cpus = cpus; |
| 77 | evlist->threads = threads; |
| 78 | } |
| 79 | |
| 80 | int perf_evlist__create_maps(struct perf_evlist *evlist, pid_t target_pid, |
| 81 | pid_t target_tid, const char *cpu_list); |
| 82 | void perf_evlist__delete_maps(struct perf_evlist *evlist); |
Frederic Weisbecker | 0a10247 | 2011-02-26 04:51:54 +0100 | [diff] [blame] | 83 | int perf_evlist__set_filters(struct perf_evlist *evlist); |
Arnaldo Carvalho de Melo | f8a9530 | 2011-01-30 10:46:46 -0200 | [diff] [blame] | 84 | |
Arnaldo Carvalho de Melo | c2a7065 | 2011-06-02 11:04:54 -0300 | [diff] [blame] | 85 | u64 perf_evlist__sample_type(const struct perf_evlist *evlist); |
| 86 | bool perf_evlist__sample_id_all(const const struct perf_evlist *evlist); |
Frederic Weisbecker | 7442996 | 2011-05-21 17:49:00 +0200 | [diff] [blame] | 87 | |
Arnaldo Carvalho de Melo | c2a7065 | 2011-06-02 11:04:54 -0300 | [diff] [blame] | 88 | bool perf_evlist__valid_sample_type(const struct perf_evlist *evlist); |
| 89 | 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] | 90 | #endif /* __PERF_EVLIST_H */ |