diff options
Diffstat (limited to 'tools/perf/util/symbol.h')
-rw-r--r-- | tools/perf/util/symbol.h | 74 |
1 files changed, 58 insertions, 16 deletions
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index f30a37428919..478f5ab37787 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,6 +48,8 @@ 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; |
@@ -63,10 +69,15 @@ struct symbol_conf { | |||
63 | show_nr_samples, | 69 | show_nr_samples, |
64 | use_callchain, | 70 | use_callchain, |
65 | exclude_other, | 71 | exclude_other, |
66 | full_paths; | 72 | full_paths, |
73 | show_cpu_utilization; | ||
67 | const char *vmlinux_name, | 74 | const char *vmlinux_name, |
68 | *field_sep; | 75 | *field_sep; |
69 | char *dso_list_str, | 76 | const char *default_guest_vmlinux_name, |
77 | *default_guest_kallsyms, | ||
78 | *default_guest_modules; | ||
79 | const char *guestmount; | ||
80 | char *dso_list_str, | ||
70 | *comm_list_str, | 81 | *comm_list_str, |
71 | *sym_list_str, | 82 | *sym_list_str, |
72 | *col_width_list_str; | 83 | *col_width_list_str; |
@@ -88,6 +99,11 @@ struct ref_reloc_sym { | |||
88 | u64 unrelocated_addr; | 99 | u64 unrelocated_addr; |
89 | }; | 100 | }; |
90 | 101 | ||
102 | struct map_symbol { | ||
103 | struct map *map; | ||
104 | struct symbol *sym; | ||
105 | }; | ||
106 | |||
91 | struct addr_location { | 107 | struct addr_location { |
92 | struct thread *thread; | 108 | struct thread *thread; |
93 | struct map *map; | 109 | struct map *map; |
@@ -95,6 +111,13 @@ struct addr_location { | |||
95 | u64 addr; | 111 | u64 addr; |
96 | char level; | 112 | char level; |
97 | bool filtered; | 113 | bool filtered; |
114 | unsigned int cpumode; | ||
115 | }; | ||
116 | |||
117 | enum dso_kernel_type { | ||
118 | DSO_TYPE_USER = 0, | ||
119 | DSO_TYPE_KERNEL, | ||
120 | DSO_TYPE_GUEST_KERNEL | ||
98 | }; | 121 | }; |
99 | 122 | ||
100 | struct dso { | 123 | struct dso { |
@@ -104,8 +127,9 @@ struct dso { | |||
104 | u8 adjust_symbols:1; | 127 | u8 adjust_symbols:1; |
105 | u8 slen_calculated:1; | 128 | u8 slen_calculated:1; |
106 | u8 has_build_id:1; | 129 | u8 has_build_id:1; |
107 | u8 kernel:1; | 130 | enum dso_kernel_type kernel; |
108 | u8 hit:1; | 131 | u8 hit:1; |
132 | u8 annotate_warned:1; | ||
109 | unsigned char origin; | 133 | unsigned char origin; |
110 | u8 sorted_by_name; | 134 | u8 sorted_by_name; |
111 | u8 loaded; | 135 | u8 loaded; |
@@ -131,42 +155,60 @@ static inline void dso__set_loaded(struct dso *self, enum map_type type) | |||
131 | 155 | ||
132 | void dso__sort_by_name(struct dso *self, enum map_type type); | 156 | void dso__sort_by_name(struct dso *self, enum map_type type); |
133 | 157 | ||
134 | extern struct list_head dsos__user, dsos__kernel; | ||
135 | |||
136 | struct dso *__dsos__findnew(struct list_head *head, const char *name); | 158 | struct dso *__dsos__findnew(struct list_head *head, const char *name); |
137 | 159 | ||
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); | 160 | 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, | 161 | int dso__load_vmlinux_path(struct dso *self, struct map *map, |
145 | symbol_filter_t filter); | 162 | symbol_filter_t filter); |
146 | int dso__load_kallsyms(struct dso *self, const char *filename, struct map *map, | 163 | int dso__load_kallsyms(struct dso *self, const char *filename, struct map *map, |
147 | symbol_filter_t filter); | 164 | symbol_filter_t filter); |
148 | void dsos__fprintf(FILE *fp); | 165 | void dsos__fprintf(struct rb_root *kerninfo_root, FILE *fp); |
149 | size_t dsos__fprintf_buildid(FILE *fp, bool with_hits); | 166 | size_t dsos__fprintf_buildid(struct rb_root *kerninfo_root, |
167 | FILE *fp, bool with_hits); | ||
150 | 168 | ||
151 | size_t dso__fprintf_buildid(struct dso *self, FILE *fp); | 169 | size_t dso__fprintf_buildid(struct dso *self, FILE *fp); |
152 | size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp); | 170 | size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp); |
171 | |||
172 | enum dso_origin { | ||
173 | DSO__ORIG_KERNEL = 0, | ||
174 | DSO__ORIG_GUEST_KERNEL, | ||
175 | DSO__ORIG_JAVA_JIT, | ||
176 | DSO__ORIG_BUILD_ID_CACHE, | ||
177 | DSO__ORIG_FEDORA, | ||
178 | DSO__ORIG_UBUNTU, | ||
179 | DSO__ORIG_BUILDID, | ||
180 | DSO__ORIG_DSO, | ||
181 | DSO__ORIG_GUEST_KMODULE, | ||
182 | DSO__ORIG_KMODULE, | ||
183 | DSO__ORIG_NOT_FOUND, | ||
184 | }; | ||
185 | |||
153 | char dso__symtab_origin(const struct dso *self); | 186 | char dso__symtab_origin(const struct dso *self); |
154 | void dso__set_long_name(struct dso *self, char *name); | 187 | void dso__set_long_name(struct dso *self, char *name); |
155 | void dso__set_build_id(struct dso *self, void *build_id); | 188 | void dso__set_build_id(struct dso *self, void *build_id); |
156 | void dso__read_running_kernel_build_id(struct dso *self); | 189 | void dso__read_running_kernel_build_id(struct dso *self, |
190 | struct kernel_info *kerninfo); | ||
157 | struct symbol *dso__find_symbol(struct dso *self, enum map_type type, u64 addr); | 191 | 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, | 192 | struct symbol *dso__find_symbol_by_name(struct dso *self, enum map_type type, |
159 | const char *name); | 193 | const char *name); |
160 | 194 | ||
161 | int filename__read_build_id(const char *filename, void *bf, size_t size); | 195 | 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); | 196 | int sysfs__read_build_id(const char *filename, void *bf, size_t size); |
163 | bool dsos__read_build_ids(bool with_hits); | 197 | bool __dsos__read_build_ids(struct list_head *head, bool with_hits); |
164 | int build_id__sprintf(const u8 *self, int len, char *bf); | 198 | int build_id__sprintf(const u8 *self, int len, char *bf); |
165 | int kallsyms__parse(const char *filename, void *arg, | 199 | int kallsyms__parse(const char *filename, void *arg, |
166 | int (*process_symbol)(void *arg, const char *name, | 200 | int (*process_symbol)(void *arg, const char *name, |
167 | char type, u64 start)); | 201 | char type, u64 start)); |
168 | 202 | ||
203 | int __map_groups__create_kernel_maps(struct map_groups *self, | ||
204 | struct map *vmlinux_maps[MAP__NR_TYPES], | ||
205 | struct dso *kernel); | ||
206 | int map_groups__create_kernel_maps(struct rb_root *kerninfo_root, pid_t pid); | ||
207 | int map_groups__create_guest_kernel_maps(struct rb_root *kerninfo_root); | ||
208 | |||
169 | int symbol__init(void); | 209 | int symbol__init(void); |
170 | bool symbol_type__is_a(char symbol_type, enum map_type map_type); | 210 | bool symbol_type__is_a(char symbol_type, enum map_type map_type); |
171 | 211 | ||
212 | size_t vmlinux_path__fprintf(FILE *fp); | ||
213 | |||
172 | #endif /* __PERF_SYMBOL */ | 214 | #endif /* __PERF_SYMBOL */ |