diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-05 18:30:21 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-05 18:30:21 -0500 |
| commit | c3fa27d1367fac63ac8533d6f20ea851d0d70a10 (patch) | |
| tree | e7731554085e22b6b63411b1ebb401079f3e0bbb /tools/perf/util/event.h | |
| parent | 96fa2b508d2d3fe040cf4ef2fffb955f0a537ea1 (diff) | |
| parent | d103d01e4b19f185d3c85f77402b605534c32e89 (diff) | |
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (470 commits)
x86: Fix comments of register/stack access functions
perf tools: Replace %m with %a in sscanf
hw-breakpoints: Keep track of user disabled breakpoints
tracing/syscalls: Make syscall events print callbacks static
tracing: Add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook
perf: Don't free perf_mmap_data until work has been done
perf_event: Fix compile error
perf tools: Fix _GNU_SOURCE macro related strndup() build error
trace_syscalls: Remove unused syscall_name_to_nr()
trace_syscalls: Simplify syscall profile
trace_syscalls: Remove duplicate init_enter_##sname()
trace_syscalls: Add syscall_nr field to struct syscall_metadata
trace_syscalls: Remove enter_id exit_id
trace_syscalls: Set event_enter_##sname->data to its metadata
trace_syscalls: Remove unused event_syscall_enter and event_syscall_exit
perf_event: Initialize data.period in perf_swevent_hrtimer()
perf probe: Simplify event naming
perf probe: Add --list option for listing current probe events
perf probe: Add argv_split() from lib/argv_split.c
perf probe: Move probe event utility functions to probe-event.c
...
Diffstat (limited to 'tools/perf/util/event.h')
| -rw-r--r-- | tools/perf/util/event.h | 75 |
1 files changed, 65 insertions, 10 deletions
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 2c9c26d6ded0..a4cc8105cf67 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h | |||
| @@ -1,14 +1,10 @@ | |||
| 1 | #ifndef __PERF_RECORD_H | 1 | #ifndef __PERF_RECORD_H |
| 2 | #define __PERF_RECORD_H | 2 | #define __PERF_RECORD_H |
| 3 | |||
| 3 | #include "../perf.h" | 4 | #include "../perf.h" |
| 4 | #include "util.h" | 5 | #include "util.h" |
| 5 | #include <linux/list.h> | 6 | #include <linux/list.h> |
| 6 | 7 | #include <linux/rbtree.h> | |
| 7 | enum { | ||
| 8 | SHOW_KERNEL = 1, | ||
| 9 | SHOW_USER = 2, | ||
| 10 | SHOW_HV = 4, | ||
| 11 | }; | ||
| 12 | 8 | ||
| 13 | /* | 9 | /* |
| 14 | * PERF_SAMPLE_IP | PERF_SAMPLE_TID | * | 10 | * PERF_SAMPLE_IP | PERF_SAMPLE_TID | * |
| @@ -65,6 +61,13 @@ struct sample_event{ | |||
| 65 | u64 array[]; | 61 | u64 array[]; |
| 66 | }; | 62 | }; |
| 67 | 63 | ||
| 64 | #define BUILD_ID_SIZE 20 | ||
| 65 | |||
| 66 | struct build_id_event { | ||
| 67 | struct perf_event_header header; | ||
| 68 | u8 build_id[ALIGN(BUILD_ID_SIZE, sizeof(u64))]; | ||
| 69 | char filename[]; | ||
| 70 | }; | ||
| 68 | 71 | ||
| 69 | typedef union event_union { | 72 | typedef union event_union { |
| 70 | struct perf_event_header header; | 73 | struct perf_event_header header; |
| @@ -77,12 +80,30 @@ typedef union event_union { | |||
| 77 | struct sample_event sample; | 80 | struct sample_event sample; |
| 78 | } event_t; | 81 | } event_t; |
| 79 | 82 | ||
| 83 | struct events_stats { | ||
| 84 | unsigned long total; | ||
| 85 | unsigned long lost; | ||
| 86 | }; | ||
| 87 | |||
| 88 | void event__print_totals(void); | ||
| 89 | |||
| 90 | enum map_type { | ||
| 91 | MAP__FUNCTION = 0, | ||
| 92 | |||
| 93 | MAP__NR_TYPES, | ||
| 94 | }; | ||
| 95 | |||
| 80 | struct map { | 96 | struct map { |
| 81 | struct list_head node; | 97 | union { |
| 98 | struct rb_node rb_node; | ||
| 99 | struct list_head node; | ||
| 100 | }; | ||
| 82 | u64 start; | 101 | u64 start; |
| 83 | u64 end; | 102 | u64 end; |
| 103 | enum map_type type; | ||
| 84 | u64 pgoff; | 104 | u64 pgoff; |
| 85 | u64 (*map_ip)(struct map *, u64); | 105 | u64 (*map_ip)(struct map *, u64); |
| 106 | u64 (*unmap_ip)(struct map *, u64); | ||
| 86 | struct dso *dso; | 107 | struct dso *dso; |
| 87 | }; | 108 | }; |
| 88 | 109 | ||
| @@ -91,14 +112,48 @@ static inline u64 map__map_ip(struct map *map, u64 ip) | |||
| 91 | return ip - map->start + map->pgoff; | 112 | return ip - map->start + map->pgoff; |
| 92 | } | 113 | } |
| 93 | 114 | ||
| 94 | static inline u64 vdso__map_ip(struct map *map __used, u64 ip) | 115 | static inline u64 map__unmap_ip(struct map *map, u64 ip) |
| 116 | { | ||
| 117 | return ip + map->start - map->pgoff; | ||
| 118 | } | ||
| 119 | |||
| 120 | static inline u64 identity__map_ip(struct map *map __used, u64 ip) | ||
| 95 | { | 121 | { |
| 96 | return ip; | 122 | return ip; |
| 97 | } | 123 | } |
| 98 | 124 | ||
| 99 | struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen); | 125 | struct symbol; |
| 126 | |||
| 127 | typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym); | ||
| 128 | |||
| 129 | void map__init(struct map *self, enum map_type type, | ||
| 130 | u64 start, u64 end, u64 pgoff, struct dso *dso); | ||
| 131 | struct map *map__new(struct mmap_event *event, enum map_type, | ||
| 132 | char *cwd, int cwdlen); | ||
| 133 | void map__delete(struct map *self); | ||
| 100 | struct map *map__clone(struct map *self); | 134 | struct map *map__clone(struct map *self); |
| 101 | int map__overlap(struct map *l, struct map *r); | 135 | int map__overlap(struct map *l, struct map *r); |
| 102 | size_t map__fprintf(struct map *self, FILE *fp); | 136 | size_t map__fprintf(struct map *self, FILE *fp); |
| 137 | struct symbol *map__find_symbol(struct map *self, u64 addr, | ||
| 138 | symbol_filter_t filter); | ||
| 139 | void map__fixup_start(struct map *self); | ||
| 140 | void map__fixup_end(struct map *self); | ||
| 141 | |||
| 142 | int event__synthesize_thread(pid_t pid, int (*process)(event_t *event)); | ||
| 143 | void event__synthesize_threads(int (*process)(event_t *event)); | ||
| 144 | |||
| 145 | extern char *event__cwd; | ||
| 146 | extern int event__cwdlen; | ||
| 147 | extern struct events_stats event__stats; | ||
| 148 | extern unsigned long event__total[PERF_RECORD_MAX]; | ||
| 149 | |||
| 150 | int event__process_comm(event_t *self); | ||
| 151 | int event__process_lost(event_t *self); | ||
| 152 | int event__process_mmap(event_t *self); | ||
| 153 | int event__process_task(event_t *self); | ||
| 154 | |||
| 155 | struct addr_location; | ||
| 156 | int event__preprocess_sample(const event_t *self, struct addr_location *al, | ||
| 157 | symbol_filter_t filter); | ||
| 103 | 158 | ||
| 104 | #endif | 159 | #endif /* __PERF_RECORD_H */ |
