Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 1 | #ifndef __PERF_RECORD_H |
| 2 | #define __PERF_RECORD_H |
John Kacur | 8b40f52 | 2009-09-24 18:02:18 +0200 | [diff] [blame] | 3 | |
Frederic Weisbecker | 1fe2c10 | 2009-08-12 10:19:53 +0200 | [diff] [blame] | 4 | #include "../perf.h" |
Frederic Weisbecker | 66e274f | 2009-08-12 11:07:25 +0200 | [diff] [blame] | 5 | #include "util.h" |
Arnaldo Carvalho de Melo | 439d473 | 2009-10-02 03:29:58 -0300 | [diff] [blame^] | 6 | #include <linux/list.h> |
Arnaldo Carvalho de Melo | 1b46cdd | 2009-09-28 14:48:46 -0300 | [diff] [blame] | 7 | #include <linux/rbtree.h> |
Frederic Weisbecker | 1fe2c10 | 2009-08-12 10:19:53 +0200 | [diff] [blame] | 8 | |
Frederic Weisbecker | 0f25bfc | 2009-08-16 19:56:54 +0200 | [diff] [blame] | 9 | enum { |
| 10 | SHOW_KERNEL = 1, |
| 11 | SHOW_USER = 2, |
| 12 | SHOW_HV = 4, |
| 13 | }; |
| 14 | |
Peter Zijlstra | 18408dd | 2009-08-13 11:47:55 +0200 | [diff] [blame] | 15 | /* |
| 16 | * PERF_SAMPLE_IP | PERF_SAMPLE_TID | * |
| 17 | */ |
Frederic Weisbecker | 1fe2c10 | 2009-08-12 10:19:53 +0200 | [diff] [blame] | 18 | struct ip_event { |
| 19 | struct perf_event_header header; |
| 20 | u64 ip; |
| 21 | u32 pid, tid; |
| 22 | unsigned char __more_data[]; |
| 23 | }; |
| 24 | |
| 25 | struct mmap_event { |
| 26 | struct perf_event_header header; |
| 27 | u32 pid, tid; |
| 28 | u64 start; |
| 29 | u64 len; |
| 30 | u64 pgoff; |
| 31 | char filename[PATH_MAX]; |
| 32 | }; |
| 33 | |
| 34 | struct comm_event { |
| 35 | struct perf_event_header header; |
| 36 | u32 pid, tid; |
| 37 | char comm[16]; |
| 38 | }; |
| 39 | |
| 40 | struct fork_event { |
| 41 | struct perf_event_header header; |
| 42 | u32 pid, ppid; |
| 43 | u32 tid, ptid; |
Arjan van de Ven | 393b2ad | 2009-09-12 07:52:47 +0200 | [diff] [blame] | 44 | u64 time; |
Frederic Weisbecker | 1fe2c10 | 2009-08-12 10:19:53 +0200 | [diff] [blame] | 45 | }; |
| 46 | |
| 47 | struct lost_event { |
| 48 | struct perf_event_header header; |
| 49 | u64 id; |
| 50 | u64 lost; |
| 51 | }; |
| 52 | |
Peter Zijlstra | 18408dd | 2009-08-13 11:47:55 +0200 | [diff] [blame] | 53 | /* |
| 54 | * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID |
| 55 | */ |
Frederic Weisbecker | 1fe2c10 | 2009-08-12 10:19:53 +0200 | [diff] [blame] | 56 | struct read_event { |
| 57 | struct perf_event_header header; |
Ingo Molnar | dc02bf7 | 2009-09-16 13:45:00 +0200 | [diff] [blame] | 58 | u32 pid, tid; |
Frederic Weisbecker | 1fe2c10 | 2009-08-12 10:19:53 +0200 | [diff] [blame] | 59 | u64 value; |
| 60 | u64 time_enabled; |
| 61 | u64 time_running; |
| 62 | u64 id; |
| 63 | }; |
| 64 | |
Arjan van de Ven | fd39e05 | 2009-09-12 07:53:00 +0200 | [diff] [blame] | 65 | struct sample_event{ |
| 66 | struct perf_event_header header; |
| 67 | u64 array[]; |
| 68 | }; |
| 69 | |
| 70 | |
Frederic Weisbecker | 1fe2c10 | 2009-08-12 10:19:53 +0200 | [diff] [blame] | 71 | typedef union event_union { |
| 72 | struct perf_event_header header; |
| 73 | struct ip_event ip; |
| 74 | struct mmap_event mmap; |
| 75 | struct comm_event comm; |
| 76 | struct fork_event fork; |
| 77 | struct lost_event lost; |
| 78 | struct read_event read; |
Arjan van de Ven | fd39e05 | 2009-09-12 07:53:00 +0200 | [diff] [blame] | 79 | struct sample_event sample; |
Frederic Weisbecker | 1fe2c10 | 2009-08-12 10:19:53 +0200 | [diff] [blame] | 80 | } event_t; |
Frederic Weisbecker | 66e274f | 2009-08-12 11:07:25 +0200 | [diff] [blame] | 81 | |
| 82 | struct map { |
Arnaldo Carvalho de Melo | 439d473 | 2009-10-02 03:29:58 -0300 | [diff] [blame^] | 83 | union { |
| 84 | struct rb_node rb_node; |
| 85 | struct list_head node; |
| 86 | }; |
Frederic Weisbecker | 66e274f | 2009-08-12 11:07:25 +0200 | [diff] [blame] | 87 | u64 start; |
| 88 | u64 end; |
| 89 | u64 pgoff; |
| 90 | u64 (*map_ip)(struct map *, u64); |
| 91 | struct dso *dso; |
| 92 | }; |
| 93 | |
| 94 | static inline u64 map__map_ip(struct map *map, u64 ip) |
| 95 | { |
| 96 | return ip - map->start + map->pgoff; |
| 97 | } |
| 98 | |
| 99 | static inline u64 vdso__map_ip(struct map *map __used, u64 ip) |
| 100 | { |
| 101 | return ip; |
| 102 | } |
| 103 | |
| 104 | struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen); |
| 105 | struct map *map__clone(struct map *self); |
| 106 | int map__overlap(struct map *l, struct map *r); |
| 107 | size_t map__fprintf(struct map *self, FILE *fp); |
| 108 | |
John Kacur | 8b40f52 | 2009-09-24 18:02:18 +0200 | [diff] [blame] | 109 | #endif /* __PERF_RECORD_H */ |