diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-12-27 18:37:00 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2009-12-28 03:03:33 -0500 |
| commit | 4a58e61161074776aa34187ea369414ce4852394 (patch) | |
| tree | 1687f14cfa02a4e656ebc7f2445901f5fddc612f /tools | |
| parent | 06aae590033d1ae3c35b2920ef950cfc603e2a2d (diff) | |
perf tools: Move the map class definition to a separate header
And this resulted in the need for adding some missing includes
in some places that were getting the definitions needed out of
sheer luck.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1261957026-15580-4-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/perf/Makefile | 1 | ||||
| -rw-r--r-- | tools/perf/util/debug.c | 1 | ||||
| -rw-r--r-- | tools/perf/util/event.h | 65 | ||||
| -rw-r--r-- | tools/perf/util/map.h | 73 | ||||
| -rw-r--r-- | tools/perf/util/probe-finder.h | 2 |
5 files changed, 80 insertions, 62 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 4172c3b0e4a7..fafea0b6f323 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
| @@ -357,6 +357,7 @@ LIB_H += util/event.h | |||
| 357 | LIB_H += util/exec_cmd.h | 357 | LIB_H += util/exec_cmd.h |
| 358 | LIB_H += util/types.h | 358 | LIB_H += util/types.h |
| 359 | LIB_H += util/levenshtein.h | 359 | LIB_H += util/levenshtein.h |
| 360 | LIB_H += util/map.h | ||
| 360 | LIB_H += util/parse-options.h | 361 | LIB_H += util/parse-options.h |
| 361 | LIB_H += util/parse-events.h | 362 | LIB_H += util/parse-events.h |
| 362 | LIB_H += util/quote.h | 363 | LIB_H += util/quote.h |
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index 28d520d5a1fb..0905600c3851 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include "color.h" | 9 | #include "color.h" |
| 10 | #include "event.h" | 10 | #include "event.h" |
| 11 | #include "debug.h" | 11 | #include "debug.h" |
| 12 | #include "util.h" | ||
| 12 | 13 | ||
| 13 | int verbose = 0; | 14 | int verbose = 0; |
| 14 | int dump_trace = 0; | 15 | int dump_trace = 0; |
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 690a96d0467c..80fb3653c809 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | #ifndef __PERF_RECORD_H | 1 | #ifndef __PERF_RECORD_H |
| 2 | #define __PERF_RECORD_H | 2 | #define __PERF_RECORD_H |
| 3 | 3 | ||
| 4 | #include <limits.h> | ||
| 5 | |||
| 4 | #include "../perf.h" | 6 | #include "../perf.h" |
| 5 | #include "util.h" | 7 | #include "map.h" |
| 6 | #include <linux/list.h> | ||
| 7 | #include <linux/rbtree.h> | ||
| 8 | 8 | ||
| 9 | /* | 9 | /* |
| 10 | * PERF_SAMPLE_IP | PERF_SAMPLE_TID | * | 10 | * PERF_SAMPLE_IP | PERF_SAMPLE_TID | * |
| @@ -101,67 +101,8 @@ struct events_stats { | |||
| 101 | 101 | ||
| 102 | void event__print_totals(void); | 102 | void event__print_totals(void); |
| 103 | 103 | ||
| 104 | enum map_type { | ||
| 105 | MAP__FUNCTION = 0, | ||
| 106 | MAP__VARIABLE, | ||
| 107 | }; | ||
| 108 | |||
| 109 | #define MAP__NR_TYPES (MAP__VARIABLE + 1) | ||
| 110 | |||
| 111 | struct map { | ||
| 112 | union { | ||
| 113 | struct rb_node rb_node; | ||
| 114 | struct list_head node; | ||
| 115 | }; | ||
| 116 | u64 start; | ||
| 117 | u64 end; | ||
| 118 | enum map_type type; | ||
| 119 | u64 pgoff; | ||
| 120 | u64 (*map_ip)(struct map *, u64); | ||
| 121 | u64 (*unmap_ip)(struct map *, u64); | ||
| 122 | struct dso *dso; | ||
| 123 | }; | ||
| 124 | |||
| 125 | static inline u64 map__map_ip(struct map *map, u64 ip) | ||
| 126 | { | ||
| 127 | return ip - map->start + map->pgoff; | ||
| 128 | } | ||
| 129 | |||
| 130 | static inline u64 map__unmap_ip(struct map *map, u64 ip) | ||
| 131 | { | ||
| 132 | return ip + map->start - map->pgoff; | ||
| 133 | } | ||
| 134 | |||
| 135 | static inline u64 identity__map_ip(struct map *map __used, u64 ip) | ||
| 136 | { | ||
| 137 | return ip; | ||
| 138 | } | ||
| 139 | |||
| 140 | struct symbol; | ||
| 141 | |||
| 142 | typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym); | ||
| 143 | |||
| 144 | void map__init(struct map *self, enum map_type type, | ||
| 145 | u64 start, u64 end, u64 pgoff, struct dso *dso); | ||
| 146 | struct map *map__new(struct mmap_event *event, enum map_type, | ||
| 147 | char *cwd, int cwdlen); | ||
| 148 | void map__delete(struct map *self); | ||
| 149 | struct map *map__clone(struct map *self); | ||
| 150 | int map__overlap(struct map *l, struct map *r); | ||
| 151 | size_t map__fprintf(struct map *self, FILE *fp); | ||
| 152 | |||
| 153 | struct perf_session; | 104 | struct perf_session; |
| 154 | 105 | ||
| 155 | int map__load(struct map *self, struct perf_session *session, | ||
| 156 | symbol_filter_t filter); | ||
| 157 | struct symbol *map__find_symbol(struct map *self, struct perf_session *session, | ||
| 158 | u64 addr, symbol_filter_t filter); | ||
| 159 | struct symbol *map__find_symbol_by_name(struct map *self, const char *name, | ||
| 160 | struct perf_session *session, | ||
| 161 | symbol_filter_t filter); | ||
| 162 | void map__fixup_start(struct map *self); | ||
| 163 | void map__fixup_end(struct map *self); | ||
| 164 | |||
| 165 | int event__synthesize_thread(pid_t pid, | 106 | int event__synthesize_thread(pid_t pid, |
| 166 | int (*process)(event_t *event, | 107 | int (*process)(event_t *event, |
| 167 | struct perf_session *session), | 108 | struct perf_session *session), |
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h new file mode 100644 index 000000000000..72f0b6ab5ea5 --- /dev/null +++ b/tools/perf/util/map.h | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | #ifndef __PERF_MAP_H | ||
| 2 | #define __PERF_MAP_H | ||
| 3 | |||
| 4 | #include <linux/compiler.h> | ||
| 5 | #include <linux/list.h> | ||
| 6 | #include <linux/rbtree.h> | ||
| 7 | #include <linux/types.h> | ||
| 8 | |||
| 9 | enum map_type { | ||
| 10 | MAP__FUNCTION = 0, | ||
| 11 | MAP__VARIABLE, | ||
| 12 | }; | ||
| 13 | |||
| 14 | #define MAP__NR_TYPES (MAP__VARIABLE + 1) | ||
| 15 | |||
| 16 | struct dso; | ||
| 17 | |||
| 18 | struct map { | ||
| 19 | union { | ||
| 20 | struct rb_node rb_node; | ||
| 21 | struct list_head node; | ||
| 22 | }; | ||
| 23 | u64 start; | ||
| 24 | u64 end; | ||
| 25 | enum map_type type; | ||
| 26 | u64 pgoff; | ||
| 27 | u64 (*map_ip)(struct map *, u64); | ||
| 28 | u64 (*unmap_ip)(struct map *, u64); | ||
| 29 | struct dso *dso; | ||
| 30 | }; | ||
| 31 | |||
| 32 | static inline u64 map__map_ip(struct map *map, u64 ip) | ||
| 33 | { | ||
| 34 | return ip - map->start + map->pgoff; | ||
| 35 | } | ||
| 36 | |||
| 37 | static inline u64 map__unmap_ip(struct map *map, u64 ip) | ||
| 38 | { | ||
| 39 | return ip + map->start - map->pgoff; | ||
| 40 | } | ||
| 41 | |||
| 42 | static inline u64 identity__map_ip(struct map *map __used, u64 ip) | ||
| 43 | { | ||
| 44 | return ip; | ||
| 45 | } | ||
| 46 | |||
| 47 | struct symbol; | ||
| 48 | struct mmap_event; | ||
| 49 | |||
| 50 | typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym); | ||
| 51 | |||
| 52 | void map__init(struct map *self, enum map_type type, | ||
| 53 | u64 start, u64 end, u64 pgoff, struct dso *dso); | ||
| 54 | struct map *map__new(struct mmap_event *event, enum map_type, | ||
| 55 | char *cwd, int cwdlen); | ||
| 56 | void map__delete(struct map *self); | ||
| 57 | struct map *map__clone(struct map *self); | ||
| 58 | int map__overlap(struct map *l, struct map *r); | ||
| 59 | size_t map__fprintf(struct map *self, FILE *fp); | ||
| 60 | |||
| 61 | struct perf_session; | ||
| 62 | |||
| 63 | int map__load(struct map *self, struct perf_session *session, | ||
| 64 | symbol_filter_t filter); | ||
| 65 | struct symbol *map__find_symbol(struct map *self, struct perf_session *session, | ||
| 66 | u64 addr, symbol_filter_t filter); | ||
| 67 | struct symbol *map__find_symbol_by_name(struct map *self, const char *name, | ||
| 68 | struct perf_session *session, | ||
| 69 | symbol_filter_t filter); | ||
| 70 | void map__fixup_start(struct map *self); | ||
| 71 | void map__fixup_end(struct map *self); | ||
| 72 | |||
| 73 | #endif /* __PERF_MAP_H */ | ||
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h index a4086aaddb73..e3f396806e6e 100644 --- a/tools/perf/util/probe-finder.h +++ b/tools/perf/util/probe-finder.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef _PROBE_FINDER_H | 1 | #ifndef _PROBE_FINDER_H |
| 2 | #define _PROBE_FINDER_H | 2 | #define _PROBE_FINDER_H |
| 3 | 3 | ||
| 4 | #include "util.h" | ||
| 5 | |||
| 4 | #define MAX_PATH_LEN 256 | 6 | #define MAX_PATH_LEN 256 |
| 5 | #define MAX_PROBE_BUFFER 1024 | 7 | #define MAX_PROBE_BUFFER 1024 |
| 6 | #define MAX_PROBES 128 | 8 | #define MAX_PROBES 128 |
