diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-03-24 15:40:18 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-26 03:52:57 -0400 |
commit | b3c9ac0846c654dea4df095999ee202e8b4cb253 (patch) | |
tree | 4845ae36123beba5bc9959be7c67cc0ce4bc5a11 | |
parent | 59fd53062f71011a68d03f4cd0ba93d822ac3249 (diff) |
perf callchains: Store the map together with the symbol
We need this to know where a symbol in a callchain came from,
for various reasons, among them precise annotation from a
TUI/GUI tool.
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: <1269459619-982-5-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | tools/perf/builtin-report.c | 3 | ||||
-rw-r--r-- | tools/perf/util/callchain.c | 21 | ||||
-rw-r--r-- | tools/perf/util/callchain.h | 4 | ||||
-rw-r--r-- | tools/perf/util/hist.c | 14 | ||||
-rw-r--r-- | tools/perf/util/newt.c | 8 | ||||
-rw-r--r-- | tools/perf/util/session.c | 13 | ||||
-rw-r--r-- | tools/perf/util/session.h | 8 |
7 files changed, 36 insertions, 35 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index d609afbd1a35..6ab16980dd66 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -81,7 +81,8 @@ static int perf_session__add_hist_entry(struct perf_session *self, | |||
81 | struct addr_location *al, | 81 | struct addr_location *al, |
82 | struct sample_data *data) | 82 | struct sample_data *data) |
83 | { | 83 | { |
84 | struct symbol **syms = NULL, *parent = NULL; | 84 | struct map_symbol *syms = NULL; |
85 | struct symbol *parent = NULL; | ||
85 | bool hit; | 86 | bool hit; |
86 | int err; | 87 | int err; |
87 | struct hist_entry *he; | 88 | struct hist_entry *he; |
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index 883844eb4b0a..db628af6d20d 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c | |||
@@ -185,8 +185,8 @@ create_child(struct callchain_node *parent, bool inherit_children) | |||
185 | 185 | ||
186 | 186 | ||
187 | struct resolved_ip { | 187 | struct resolved_ip { |
188 | u64 ip; | 188 | u64 ip; |
189 | struct symbol *sym; | 189 | struct map_symbol ms; |
190 | }; | 190 | }; |
191 | 191 | ||
192 | struct resolved_chain { | 192 | struct resolved_chain { |
@@ -212,7 +212,7 @@ fill_node(struct callchain_node *node, struct resolved_chain *chain, int start) | |||
212 | return; | 212 | return; |
213 | } | 213 | } |
214 | call->ip = chain->ips[i].ip; | 214 | call->ip = chain->ips[i].ip; |
215 | call->sym = chain->ips[i].sym; | 215 | call->ms = chain->ips[i].ms; |
216 | list_add_tail(&call->list, &node->val); | 216 | list_add_tail(&call->list, &node->val); |
217 | } | 217 | } |
218 | node->val_nr = chain->nr - start; | 218 | node->val_nr = chain->nr - start; |
@@ -318,10 +318,10 @@ __append_chain(struct callchain_node *root, struct resolved_chain *chain, | |||
318 | if (i == chain->nr) | 318 | if (i == chain->nr) |
319 | break; | 319 | break; |
320 | 320 | ||
321 | sym = chain->ips[i].sym; | 321 | sym = chain->ips[i].ms.sym; |
322 | 322 | ||
323 | if (cnode->sym && sym) { | 323 | if (cnode->ms.sym && sym) { |
324 | if (cnode->sym->start != sym->start) | 324 | if (cnode->ms.sym->start != sym->start) |
325 | break; | 325 | break; |
326 | } else if (cnode->ip != chain->ips[i].ip) | 326 | } else if (cnode->ip != chain->ips[i].ip) |
327 | break; | 327 | break; |
@@ -353,9 +353,8 @@ __append_chain(struct callchain_node *root, struct resolved_chain *chain, | |||
353 | return 0; | 353 | return 0; |
354 | } | 354 | } |
355 | 355 | ||
356 | static void | 356 | static void filter_context(struct ip_callchain *old, struct resolved_chain *new, |
357 | filter_context(struct ip_callchain *old, struct resolved_chain *new, | 357 | struct map_symbol *syms) |
358 | struct symbol **syms) | ||
359 | { | 358 | { |
360 | int i, j = 0; | 359 | int i, j = 0; |
361 | 360 | ||
@@ -364,7 +363,7 @@ filter_context(struct ip_callchain *old, struct resolved_chain *new, | |||
364 | continue; | 363 | continue; |
365 | 364 | ||
366 | new->ips[j].ip = old->ips[i]; | 365 | new->ips[j].ip = old->ips[i]; |
367 | new->ips[j].sym = syms[i]; | 366 | new->ips[j].ms = syms[i]; |
368 | j++; | 367 | j++; |
369 | } | 368 | } |
370 | 369 | ||
@@ -373,7 +372,7 @@ filter_context(struct ip_callchain *old, struct resolved_chain *new, | |||
373 | 372 | ||
374 | 373 | ||
375 | int append_chain(struct callchain_node *root, struct ip_callchain *chain, | 374 | int append_chain(struct callchain_node *root, struct ip_callchain *chain, |
376 | struct symbol **syms) | 375 | struct map_symbol *syms) |
377 | { | 376 | { |
378 | struct resolved_chain *filtered; | 377 | struct resolved_chain *filtered; |
379 | 378 | ||
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h index bbd76da27f22..8a7e8bbd0fda 100644 --- a/tools/perf/util/callchain.h +++ b/tools/perf/util/callchain.h | |||
@@ -39,7 +39,7 @@ struct callchain_param { | |||
39 | 39 | ||
40 | struct callchain_list { | 40 | struct callchain_list { |
41 | u64 ip; | 41 | u64 ip; |
42 | struct symbol *sym; | 42 | struct map_symbol ms; |
43 | struct list_head list; | 43 | struct list_head list; |
44 | }; | 44 | }; |
45 | 45 | ||
@@ -57,5 +57,5 @@ static inline u64 cumul_hits(struct callchain_node *node) | |||
57 | 57 | ||
58 | int register_callchain_param(struct callchain_param *param); | 58 | int register_callchain_param(struct callchain_param *param); |
59 | int append_chain(struct callchain_node *root, struct ip_callchain *chain, | 59 | int append_chain(struct callchain_node *root, struct ip_callchain *chain, |
60 | struct symbol **syms); | 60 | struct map_symbol *syms); |
61 | #endif /* __PERF_CALLCHAIN_H */ | 61 | #endif /* __PERF_CALLCHAIN_H */ |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 4eefb52a8661..09e09e78cb62 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -260,8 +260,8 @@ static size_t ipchain__fprintf_graph(FILE *fp, struct callchain_list *chain, | |||
260 | } else | 260 | } else |
261 | ret += fprintf(fp, "%s", " "); | 261 | ret += fprintf(fp, "%s", " "); |
262 | } | 262 | } |
263 | if (chain->sym) | 263 | if (chain->ms.sym) |
264 | ret += fprintf(fp, "%s\n", chain->sym->name); | 264 | ret += fprintf(fp, "%s\n", chain->ms.sym->name); |
265 | else | 265 | else |
266 | ret += fprintf(fp, "%p\n", (void *)(long)chain->ip); | 266 | ret += fprintf(fp, "%p\n", (void *)(long)chain->ip); |
267 | 267 | ||
@@ -280,7 +280,7 @@ static void init_rem_hits(void) | |||
280 | } | 280 | } |
281 | 281 | ||
282 | strcpy(rem_sq_bracket->name, "[...]"); | 282 | strcpy(rem_sq_bracket->name, "[...]"); |
283 | rem_hits.sym = rem_sq_bracket; | 283 | rem_hits.ms.sym = rem_sq_bracket; |
284 | } | 284 | } |
285 | 285 | ||
286 | static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self, | 286 | static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self, |
@@ -382,8 +382,8 @@ static size_t callchain__fprintf_graph(FILE *fp, struct callchain_node *self, | |||
382 | } else | 382 | } else |
383 | ret += callchain__fprintf_left_margin(fp, left_margin); | 383 | ret += callchain__fprintf_left_margin(fp, left_margin); |
384 | 384 | ||
385 | if (chain->sym) | 385 | if (chain->ms.sym) |
386 | ret += fprintf(fp, " %s\n", chain->sym->name); | 386 | ret += fprintf(fp, " %s\n", chain->ms.sym->name); |
387 | else | 387 | else |
388 | ret += fprintf(fp, " %p\n", (void *)(long)chain->ip); | 388 | ret += fprintf(fp, " %p\n", (void *)(long)chain->ip); |
389 | } | 389 | } |
@@ -408,8 +408,8 @@ static size_t callchain__fprintf_flat(FILE *fp, struct callchain_node *self, | |||
408 | list_for_each_entry(chain, &self->val, list) { | 408 | list_for_each_entry(chain, &self->val, list) { |
409 | if (chain->ip >= PERF_CONTEXT_MAX) | 409 | if (chain->ip >= PERF_CONTEXT_MAX) |
410 | continue; | 410 | continue; |
411 | if (chain->sym) | 411 | if (chain->ms.sym) |
412 | ret += fprintf(fp, " %s\n", chain->sym->name); | 412 | ret += fprintf(fp, " %s\n", chain->ms.sym->name); |
413 | else | 413 | else |
414 | ret += fprintf(fp, " %p\n", | 414 | ret += fprintf(fp, " %p\n", |
415 | (void *)(long)chain->ip); | 415 | (void *)(long)chain->ip); |
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c index 25cd2e1f4251..f6953ca89bbc 100644 --- a/tools/perf/util/newt.c +++ b/tools/perf/util/newt.c | |||
@@ -104,8 +104,8 @@ static void newt_checkbox_tree__add(newtComponent tree, const char *str, | |||
104 | static char *callchain_list__sym_name(struct callchain_list *self, | 104 | static char *callchain_list__sym_name(struct callchain_list *self, |
105 | char *bf, size_t bfsize) | 105 | char *bf, size_t bfsize) |
106 | { | 106 | { |
107 | if (self->sym) | 107 | if (self->ms.sym) |
108 | return self->sym->name; | 108 | return self->ms.sym->name; |
109 | 109 | ||
110 | snprintf(bf, bfsize, "%#Lx", self->ip); | 110 | snprintf(bf, bfsize, "%#Lx", self->ip); |
111 | return bf; | 111 | return bf; |
@@ -157,7 +157,7 @@ static void __callchain__append_graph_browser(struct callchain_node *self, | |||
157 | indexes[depth + 2] = NEWT_ARG_LAST; | 157 | indexes[depth + 2] = NEWT_ARG_LAST; |
158 | ++chain_idx; | 158 | ++chain_idx; |
159 | } | 159 | } |
160 | newt_checkbox_tree__add(tree, str, chain->sym, indexes); | 160 | newt_checkbox_tree__add(tree, str, chain->ms.sym, indexes); |
161 | free(alloc_str); | 161 | free(alloc_str); |
162 | ++printed; | 162 | ++printed; |
163 | } | 163 | } |
@@ -193,7 +193,7 @@ static void callchain__append_graph_browser(struct callchain_node *self, | |||
193 | continue; | 193 | continue; |
194 | 194 | ||
195 | str = callchain_list__sym_name(chain, ipstr, sizeof(ipstr)); | 195 | str = callchain_list__sym_name(chain, ipstr, sizeof(ipstr)); |
196 | newt_checkbox_tree__add(tree, str, chain->sym, indexes); | 196 | newt_checkbox_tree__add(tree, str, chain->ms.sym, indexes); |
197 | } | 197 | } |
198 | 198 | ||
199 | indexes[1] = parent_idx; | 199 | indexes[1] = parent_idx; |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index eed1cb889008..2cef3730cd99 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -117,13 +117,13 @@ static bool symbol__match_parent_regex(struct symbol *sym) | |||
117 | return 0; | 117 | return 0; |
118 | } | 118 | } |
119 | 119 | ||
120 | struct symbol **perf_session__resolve_callchain(struct perf_session *self, | 120 | struct map_symbol *perf_session__resolve_callchain(struct perf_session *self, |
121 | struct thread *thread, | 121 | struct thread *thread, |
122 | struct ip_callchain *chain, | 122 | struct ip_callchain *chain, |
123 | struct symbol **parent) | 123 | struct symbol **parent) |
124 | { | 124 | { |
125 | u8 cpumode = PERF_RECORD_MISC_USER; | 125 | u8 cpumode = PERF_RECORD_MISC_USER; |
126 | struct symbol **syms = NULL; | 126 | struct map_symbol *syms = NULL; |
127 | unsigned int i; | 127 | unsigned int i; |
128 | 128 | ||
129 | if (symbol_conf.use_callchain) { | 129 | if (symbol_conf.use_callchain) { |
@@ -160,7 +160,8 @@ struct symbol **perf_session__resolve_callchain(struct perf_session *self, | |||
160 | *parent = al.sym; | 160 | *parent = al.sym; |
161 | if (!symbol_conf.use_callchain) | 161 | if (!symbol_conf.use_callchain) |
162 | break; | 162 | break; |
163 | syms[i] = al.sym; | 163 | syms[i].map = al.map; |
164 | syms[i].sym = al.sym; | ||
164 | } | 165 | } |
165 | } | 166 | } |
166 | 167 | ||
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h index 34d73395baac..631f8157fc17 100644 --- a/tools/perf/util/session.h +++ b/tools/perf/util/session.h | |||
@@ -57,10 +57,10 @@ int __perf_session__process_events(struct perf_session *self, | |||
57 | int perf_session__process_events(struct perf_session *self, | 57 | int perf_session__process_events(struct perf_session *self, |
58 | struct perf_event_ops *event_ops); | 58 | struct perf_event_ops *event_ops); |
59 | 59 | ||
60 | struct symbol **perf_session__resolve_callchain(struct perf_session *self, | 60 | struct map_symbol *perf_session__resolve_callchain(struct perf_session *self, |
61 | struct thread *thread, | 61 | struct thread *thread, |
62 | struct ip_callchain *chain, | 62 | struct ip_callchain *chain, |
63 | struct symbol **parent); | 63 | struct symbol **parent); |
64 | 64 | ||
65 | bool perf_session__has_traces(struct perf_session *self, const char *msg); | 65 | bool perf_session__has_traces(struct perf_session *self, const char *msg); |
66 | 66 | ||