diff options
Diffstat (limited to 'tools/perf/util/symbol.h')
-rw-r--r-- | tools/perf/util/symbol.h | 80 |
1 files changed, 64 insertions, 16 deletions
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index f30a37428919..032469e41876 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -3,10 +3,11 @@ | |||
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <stdbool.h> | 5 | #include <stdbool.h> |
6 | #include "types.h" | 6 | #include <stdint.h> |
7 | #include "map.h" | ||
7 | #include <linux/list.h> | 8 | #include <linux/list.h> |
8 | #include <linux/rbtree.h> | 9 | #include <linux/rbtree.h> |
9 | #include "event.h" | 10 | #include <stdio.h> |
10 | 11 | ||
11 | #define DEBUG_CACHE_DIR ".debug" | 12 | #define DEBUG_CACHE_DIR ".debug" |
12 | 13 | ||
@@ -29,6 +30,9 @@ static inline char *bfd_demangle(void __used *v, const char __used *c, | |||
29 | #endif | 30 | #endif |
30 | #endif | 31 | #endif |
31 | 32 | ||
33 | int hex2u64(const char *ptr, u64 *val); | ||
34 | char *strxfrchar(char *s, char from, char to); | ||
35 | |||
32 | /* | 36 | /* |
33 | * libelf 0.8.x and earlier do not support ELF_C_READ_MMAP; | 37 | * libelf 0.8.x and earlier do not support ELF_C_READ_MMAP; |
34 | * for newer versions we can use mmap to reduce memory usage: | 38 | * for newer versions we can use mmap to reduce memory usage: |
@@ -44,10 +48,13 @@ static inline char *bfd_demangle(void __used *v, const char __used *c, | |||
44 | #define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ | 48 | #define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ |
45 | #endif | 49 | #endif |
46 | 50 | ||
51 | #define BUILD_ID_SIZE 20 | ||
52 | |||
47 | struct symbol { | 53 | struct symbol { |
48 | struct rb_node rb_node; | 54 | struct rb_node rb_node; |
49 | u64 start; | 55 | u64 start; |
50 | u64 end; | 56 | u64 end; |
57 | u16 namelen; | ||
51 | char name[0]; | 58 | char name[0]; |
52 | }; | 59 | }; |
53 | 60 | ||
@@ -63,10 +70,15 @@ struct symbol_conf { | |||
63 | show_nr_samples, | 70 | show_nr_samples, |
64 | use_callchain, | 71 | use_callchain, |
65 | exclude_other, | 72 | exclude_other, |
66 | full_paths; | 73 | full_paths, |
74 | show_cpu_utilization; | ||
67 | const char *vmlinux_name, | 75 | const char *vmlinux_name, |
68 | *field_sep; | 76 | *field_sep; |
69 | char *dso_list_str, | 77 | const char *default_guest_vmlinux_name, |
78 | *default_guest_kallsyms, | ||
79 | *default_guest_modules; | ||
80 | const char *guestmount; | ||
81 | const char *dso_list_str, | ||
70 | *comm_list_str, | 82 | *comm_list_str, |
71 | *sym_list_str, | 83 | *sym_list_str, |
72 | *col_width_list_str; | 84 | *col_width_list_str; |
@@ -88,6 +100,11 @@ struct ref_reloc_sym { | |||
88 | u64 unrelocated_addr; | 100 | u64 unrelocated_addr; |
89 | }; | 101 | }; |
90 | 102 | ||
103 | struct map_symbol { | ||
104 | struct map *map; | ||
105 | struct symbol *sym; | ||
106 | }; | ||
107 | |||
91 | struct addr_location { | 108 | struct addr_location { |
92 | struct thread *thread; | 109 | struct thread *thread; |
93 | struct map *map; | 110 | struct map *map; |
@@ -95,6 +112,13 @@ struct addr_location { | |||
95 | u64 addr; | 112 | u64 addr; |
96 | char level; | 113 | char level; |
97 | bool filtered; | 114 | bool filtered; |
115 | unsigned int cpumode; | ||
116 | }; | ||
117 | |||
118 | enum dso_kernel_type { | ||
119 | DSO_TYPE_USER = 0, | ||
120 | DSO_TYPE_KERNEL, | ||
121 | DSO_TYPE_GUEST_KERNEL | ||
98 | }; | 122 | }; |
99 | 123 | ||
100 | struct dso { | 124 | struct dso { |
@@ -104,8 +128,9 @@ struct dso { | |||
104 | u8 adjust_symbols:1; | 128 | u8 adjust_symbols:1; |
105 | u8 slen_calculated:1; | 129 | u8 slen_calculated:1; |
106 | u8 has_build_id:1; | 130 | u8 has_build_id:1; |
107 | u8 kernel:1; | 131 | enum dso_kernel_type kernel; |
108 | u8 hit:1; | 132 | u8 hit:1; |
133 | u8 annotate_warned:1; | ||
109 | unsigned char origin; | 134 | unsigned char origin; |
110 | u8 sorted_by_name; | 135 | u8 sorted_by_name; |
111 | u8 loaded; | 136 | u8 loaded; |
@@ -131,42 +156,65 @@ static inline void dso__set_loaded(struct dso *self, enum map_type type) | |||
131 | 156 | ||
132 | void dso__sort_by_name(struct dso *self, enum map_type type); | 157 | void dso__sort_by_name(struct dso *self, enum map_type type); |
133 | 158 | ||
134 | extern struct list_head dsos__user, dsos__kernel; | ||
135 | |||
136 | struct dso *__dsos__findnew(struct list_head *head, const char *name); | 159 | struct dso *__dsos__findnew(struct list_head *head, const char *name); |
137 | 160 | ||
138 | static inline struct dso *dsos__findnew(const char *name) | ||
139 | { | ||
140 | return __dsos__findnew(&dsos__user, name); | ||
141 | } | ||
142 | |||
143 | int dso__load(struct dso *self, struct map *map, symbol_filter_t filter); | 161 | int dso__load(struct dso *self, struct map *map, symbol_filter_t filter); |
144 | int dso__load_vmlinux_path(struct dso *self, struct map *map, | 162 | int dso__load_vmlinux_path(struct dso *self, struct map *map, |
145 | symbol_filter_t filter); | 163 | symbol_filter_t filter); |
146 | int dso__load_kallsyms(struct dso *self, const char *filename, struct map *map, | 164 | int dso__load_kallsyms(struct dso *self, const char *filename, struct map *map, |
147 | symbol_filter_t filter); | 165 | symbol_filter_t filter); |
148 | void dsos__fprintf(FILE *fp); | 166 | int machine__load_kallsyms(struct machine *self, const char *filename, |
149 | size_t dsos__fprintf_buildid(FILE *fp, bool with_hits); | 167 | enum map_type type, symbol_filter_t filter); |
168 | int machine__load_vmlinux_path(struct machine *self, enum map_type type, | ||
169 | symbol_filter_t filter); | ||
170 | |||
171 | size_t __dsos__fprintf(struct list_head *head, FILE *fp); | ||
172 | |||
173 | size_t machines__fprintf_dsos(struct rb_root *self, FILE *fp); | ||
174 | size_t machines__fprintf_dsos_buildid(struct rb_root *self, FILE *fp, bool with_hits); | ||
150 | 175 | ||
151 | size_t dso__fprintf_buildid(struct dso *self, FILE *fp); | 176 | size_t dso__fprintf_buildid(struct dso *self, FILE *fp); |
152 | size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp); | 177 | size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp); |
178 | |||
179 | enum dso_origin { | ||
180 | DSO__ORIG_KERNEL = 0, | ||
181 | DSO__ORIG_GUEST_KERNEL, | ||
182 | DSO__ORIG_JAVA_JIT, | ||
183 | DSO__ORIG_BUILD_ID_CACHE, | ||
184 | DSO__ORIG_FEDORA, | ||
185 | DSO__ORIG_UBUNTU, | ||
186 | DSO__ORIG_BUILDID, | ||
187 | DSO__ORIG_DSO, | ||
188 | DSO__ORIG_GUEST_KMODULE, | ||
189 | DSO__ORIG_KMODULE, | ||
190 | DSO__ORIG_NOT_FOUND, | ||
191 | }; | ||
192 | |||
153 | char dso__symtab_origin(const struct dso *self); | 193 | char dso__symtab_origin(const struct dso *self); |
154 | void dso__set_long_name(struct dso *self, char *name); | 194 | void dso__set_long_name(struct dso *self, char *name); |
155 | void dso__set_build_id(struct dso *self, void *build_id); | 195 | void dso__set_build_id(struct dso *self, void *build_id); |
156 | void dso__read_running_kernel_build_id(struct dso *self); | 196 | void dso__read_running_kernel_build_id(struct dso *self, struct machine *machine); |
157 | struct symbol *dso__find_symbol(struct dso *self, enum map_type type, u64 addr); | 197 | struct symbol *dso__find_symbol(struct dso *self, enum map_type type, u64 addr); |
158 | struct symbol *dso__find_symbol_by_name(struct dso *self, enum map_type type, | 198 | struct symbol *dso__find_symbol_by_name(struct dso *self, enum map_type type, |
159 | const char *name); | 199 | const char *name); |
160 | 200 | ||
161 | int filename__read_build_id(const char *filename, void *bf, size_t size); | 201 | int filename__read_build_id(const char *filename, void *bf, size_t size); |
162 | int sysfs__read_build_id(const char *filename, void *bf, size_t size); | 202 | int sysfs__read_build_id(const char *filename, void *bf, size_t size); |
163 | bool dsos__read_build_ids(bool with_hits); | 203 | bool __dsos__read_build_ids(struct list_head *head, bool with_hits); |
164 | int build_id__sprintf(const u8 *self, int len, char *bf); | 204 | int build_id__sprintf(const u8 *self, int len, char *bf); |
165 | int kallsyms__parse(const char *filename, void *arg, | 205 | int kallsyms__parse(const char *filename, void *arg, |
166 | int (*process_symbol)(void *arg, const char *name, | 206 | int (*process_symbol)(void *arg, const char *name, |
167 | char type, u64 start)); | 207 | char type, u64 start)); |
168 | 208 | ||
209 | int __machine__create_kernel_maps(struct machine *self, struct dso *kernel); | ||
210 | int machine__create_kernel_maps(struct machine *self); | ||
211 | |||
212 | int machines__create_kernel_maps(struct rb_root *self, pid_t pid); | ||
213 | int machines__create_guest_kernel_maps(struct rb_root *self); | ||
214 | |||
169 | int symbol__init(void); | 215 | int symbol__init(void); |
170 | bool symbol_type__is_a(char symbol_type, enum map_type map_type); | 216 | bool symbol_type__is_a(char symbol_type, enum map_type map_type); |
171 | 217 | ||
218 | size_t vmlinux_path__fprintf(FILE *fp); | ||
219 | |||
172 | #endif /* __PERF_SYMBOL */ | 220 | #endif /* __PERF_SYMBOL */ |