diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-28 13:20:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-28 13:20:25 -0500 |
commit | 6556a6743549defc32e5f90ee2cb1ecd833a44c3 (patch) | |
tree | 622306583d4a3c13235a8bfc012854c125c597f1 /tools/perf/util/map.h | |
parent | e0d272429a34ff143bfa04ee8e29dd4eed2964c7 (diff) | |
parent | 1dd2980d990068e20045b90c424518cc7f3657ff (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: (172 commits)
perf_event, amd: Fix spinlock initialization
perf_event: Fix preempt warning in perf_clock()
perf tools: Flush maps on COMM events
perf_events, x86: Split PMU definitions into separate files
perf annotate: Handle samples not at objdump output addr boundaries
perf_events, x86: Remove superflous MSR writes
perf_events: Simplify code by removing cpu argument to hw_perf_group_sched_in()
perf_events, x86: AMD event scheduling
perf_events: Add new start/stop PMU callbacks
perf_events: Report the MMAP pgoff value in bytes
perf annotate: Defer allocating sym_priv->hist array
perf symbols: Improve debugging information about symtab origins
perf top: Use a macro instead of a constant variable
perf symbols: Check the right return variable
perf/scripts: Tag syscall_name helper as not yet available
perf/scripts: Add perf-trace-python Documentation
perf/scripts: Remove unnecessary PyTuple resizes
perf/scripts: Add syscall tracing scripts
perf/scripts: Add Python scripting engine
perf/scripts: Remove check-perf-trace from listed scripts
...
Fix trivial conflict in tools/perf/util/probe-event.c
Diffstat (limited to 'tools/perf/util/map.h')
-rw-r--r-- | tools/perf/util/map.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h new file mode 100644 index 000000000000..b756368076c6 --- /dev/null +++ b/tools/perf/util/map.h | |||
@@ -0,0 +1,94 @@ | |||
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 | extern const char *map_type__name[MAP__NR_TYPES]; | ||
17 | |||
18 | struct dso; | ||
19 | struct ref_reloc_sym; | ||
20 | struct map_groups; | ||
21 | |||
22 | struct map { | ||
23 | union { | ||
24 | struct rb_node rb_node; | ||
25 | struct list_head node; | ||
26 | }; | ||
27 | u64 start; | ||
28 | u64 end; | ||
29 | enum map_type type; | ||
30 | u64 pgoff; | ||
31 | |||
32 | /* ip -> dso rip */ | ||
33 | u64 (*map_ip)(struct map *, u64); | ||
34 | /* dso rip -> ip */ | ||
35 | u64 (*unmap_ip)(struct map *, u64); | ||
36 | |||
37 | struct dso *dso; | ||
38 | }; | ||
39 | |||
40 | struct kmap { | ||
41 | struct ref_reloc_sym *ref_reloc_sym; | ||
42 | struct map_groups *kmaps; | ||
43 | }; | ||
44 | |||
45 | static inline struct kmap *map__kmap(struct map *self) | ||
46 | { | ||
47 | return (struct kmap *)(self + 1); | ||
48 | } | ||
49 | |||
50 | static inline u64 map__map_ip(struct map *map, u64 ip) | ||
51 | { | ||
52 | return ip - map->start + map->pgoff; | ||
53 | } | ||
54 | |||
55 | static inline u64 map__unmap_ip(struct map *map, u64 ip) | ||
56 | { | ||
57 | return ip + map->start - map->pgoff; | ||
58 | } | ||
59 | |||
60 | static inline u64 identity__map_ip(struct map *map __used, u64 ip) | ||
61 | { | ||
62 | return ip; | ||
63 | } | ||
64 | |||
65 | |||
66 | /* rip/ip <-> addr suitable for passing to `objdump --start-address=` */ | ||
67 | u64 map__rip_2objdump(struct map *map, u64 rip); | ||
68 | u64 map__objdump_2ip(struct map *map, u64 addr); | ||
69 | |||
70 | struct symbol; | ||
71 | struct mmap_event; | ||
72 | |||
73 | typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym); | ||
74 | |||
75 | void map__init(struct map *self, enum map_type type, | ||
76 | u64 start, u64 end, u64 pgoff, struct dso *dso); | ||
77 | struct map *map__new(struct mmap_event *event, enum map_type, | ||
78 | char *cwd, int cwdlen); | ||
79 | void map__delete(struct map *self); | ||
80 | struct map *map__clone(struct map *self); | ||
81 | int map__overlap(struct map *l, struct map *r); | ||
82 | size_t map__fprintf(struct map *self, FILE *fp); | ||
83 | |||
84 | int map__load(struct map *self, symbol_filter_t filter); | ||
85 | struct symbol *map__find_symbol(struct map *self, | ||
86 | u64 addr, symbol_filter_t filter); | ||
87 | struct symbol *map__find_symbol_by_name(struct map *self, const char *name, | ||
88 | symbol_filter_t filter); | ||
89 | void map__fixup_start(struct map *self); | ||
90 | void map__fixup_end(struct map *self); | ||
91 | |||
92 | void map__reloc_vmlinux(struct map *self); | ||
93 | |||
94 | #endif /* __PERF_MAP_H */ | ||