diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-03-24 15:40:17 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-26 03:52:57 -0400 |
commit | 59fd53062f71011a68d03f4cd0ba93d822ac3249 (patch) | |
tree | d707ca954b8e1fb9c0808b23d83951f357ac8a0d /tools/perf/builtin-annotate.c | |
parent | ac73c5a9c1767b2771e6d2b5accafdef89db04c2 (diff) |
perf tools: Introduce struct map_symbol
That will be in both struct hist_entry and struct
callchain_list, so that the TUI can store a pointer to the pair
(map, symbol) in the trees where hist_entries and
callchain_lists are present, to allow precise annotation instead
of looking for the first symbol with the selected name.
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-4-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-annotate.c')
-rw-r--r-- | tools/perf/builtin-annotate.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index ce9b1ef784b0..887e8e04a6f9 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -69,13 +69,13 @@ static int sym__alloc_hist(struct symbol *self) | |||
69 | static int annotate__hist_hit(struct hist_entry *he, u64 ip) | 69 | static int annotate__hist_hit(struct hist_entry *he, u64 ip) |
70 | { | 70 | { |
71 | unsigned int sym_size, offset; | 71 | unsigned int sym_size, offset; |
72 | struct symbol *sym = he->sym; | 72 | struct symbol *sym = he->ms.sym; |
73 | struct sym_priv *priv; | 73 | struct sym_priv *priv; |
74 | struct sym_hist *h; | 74 | struct sym_hist *h; |
75 | 75 | ||
76 | he->count++; | 76 | he->count++; |
77 | 77 | ||
78 | if (!sym || !he->map) | 78 | if (!sym || !he->ms.map) |
79 | return 0; | 79 | return 0; |
80 | 80 | ||
81 | priv = symbol__priv(sym); | 81 | priv = symbol__priv(sym); |
@@ -85,7 +85,7 @@ static int annotate__hist_hit(struct hist_entry *he, u64 ip) | |||
85 | sym_size = sym->end - sym->start; | 85 | sym_size = sym->end - sym->start; |
86 | offset = ip - sym->start; | 86 | offset = ip - sym->start; |
87 | 87 | ||
88 | pr_debug3("%s: ip=%#Lx\n", __func__, he->map->unmap_ip(he->map, ip)); | 88 | pr_debug3("%s: ip=%#Lx\n", __func__, he->ms.map->unmap_ip(he->ms.map, ip)); |
89 | 89 | ||
90 | if (offset >= sym_size) | 90 | if (offset >= sym_size) |
91 | return 0; | 91 | return 0; |
@@ -94,8 +94,8 @@ static int annotate__hist_hit(struct hist_entry *he, u64 ip) | |||
94 | h->sum++; | 94 | h->sum++; |
95 | h->ip[offset]++; | 95 | h->ip[offset]++; |
96 | 96 | ||
97 | pr_debug3("%#Lx %s: count++ [ip: %#Lx, %#Lx] => %Ld\n", he->sym->start, | 97 | pr_debug3("%#Lx %s: count++ [ip: %#Lx, %#Lx] => %Ld\n", he->ms.sym->start, |
98 | he->sym->name, ip, ip - he->sym->start, h->ip[offset]); | 98 | he->ms.sym->name, ip, ip - he->ms.sym->start, h->ip[offset]); |
99 | return 0; | 99 | return 0; |
100 | } | 100 | } |
101 | 101 | ||
@@ -187,7 +187,7 @@ static struct objdump_line *objdump__get_next_ip_line(struct list_head *head, | |||
187 | static int parse_line(FILE *file, struct hist_entry *he, | 187 | static int parse_line(FILE *file, struct hist_entry *he, |
188 | struct list_head *head) | 188 | struct list_head *head) |
189 | { | 189 | { |
190 | struct symbol *sym = he->sym; | 190 | struct symbol *sym = he->ms.sym; |
191 | struct objdump_line *objdump_line; | 191 | struct objdump_line *objdump_line; |
192 | char *line = NULL, *tmp, *tmp2; | 192 | char *line = NULL, *tmp, *tmp2; |
193 | size_t line_len; | 193 | size_t line_len; |
@@ -226,7 +226,7 @@ static int parse_line(FILE *file, struct hist_entry *he, | |||
226 | } | 226 | } |
227 | 227 | ||
228 | if (line_ip != -1) { | 228 | if (line_ip != -1) { |
229 | u64 start = map__rip_2objdump(he->map, sym->start); | 229 | u64 start = map__rip_2objdump(he->ms.map, sym->start); |
230 | offset = line_ip - start; | 230 | offset = line_ip - start; |
231 | } | 231 | } |
232 | 232 | ||
@@ -244,7 +244,7 @@ static int objdump_line__print(struct objdump_line *self, | |||
244 | struct list_head *head, | 244 | struct list_head *head, |
245 | struct hist_entry *he, u64 len) | 245 | struct hist_entry *he, u64 len) |
246 | { | 246 | { |
247 | struct symbol *sym = he->sym; | 247 | struct symbol *sym = he->ms.sym; |
248 | static const char *prev_line; | 248 | static const char *prev_line; |
249 | static const char *prev_color; | 249 | static const char *prev_color; |
250 | 250 | ||
@@ -327,7 +327,7 @@ static void insert_source_line(struct sym_ext *sym_ext) | |||
327 | 327 | ||
328 | static void free_source_line(struct hist_entry *he, int len) | 328 | static void free_source_line(struct hist_entry *he, int len) |
329 | { | 329 | { |
330 | struct sym_priv *priv = symbol__priv(he->sym); | 330 | struct sym_priv *priv = symbol__priv(he->ms.sym); |
331 | struct sym_ext *sym_ext = priv->ext; | 331 | struct sym_ext *sym_ext = priv->ext; |
332 | int i; | 332 | int i; |
333 | 333 | ||
@@ -346,7 +346,7 @@ static void free_source_line(struct hist_entry *he, int len) | |||
346 | static void | 346 | static void |
347 | get_source_line(struct hist_entry *he, int len, const char *filename) | 347 | get_source_line(struct hist_entry *he, int len, const char *filename) |
348 | { | 348 | { |
349 | struct symbol *sym = he->sym; | 349 | struct symbol *sym = he->ms.sym; |
350 | u64 start; | 350 | u64 start; |
351 | int i; | 351 | int i; |
352 | char cmd[PATH_MAX * 2]; | 352 | char cmd[PATH_MAX * 2]; |
@@ -361,7 +361,7 @@ get_source_line(struct hist_entry *he, int len, const char *filename) | |||
361 | if (!priv->ext) | 361 | if (!priv->ext) |
362 | return; | 362 | return; |
363 | 363 | ||
364 | start = he->map->unmap_ip(he->map, sym->start); | 364 | start = he->ms.map->unmap_ip(he->ms.map, sym->start); |
365 | 365 | ||
366 | for (i = 0; i < len; i++) { | 366 | for (i = 0; i < len; i++) { |
367 | char *path = NULL; | 367 | char *path = NULL; |
@@ -425,7 +425,7 @@ static void print_summary(const char *filename) | |||
425 | 425 | ||
426 | static void hist_entry__print_hits(struct hist_entry *self) | 426 | static void hist_entry__print_hits(struct hist_entry *self) |
427 | { | 427 | { |
428 | struct symbol *sym = self->sym; | 428 | struct symbol *sym = self->ms.sym; |
429 | struct sym_priv *priv = symbol__priv(sym); | 429 | struct sym_priv *priv = symbol__priv(sym); |
430 | struct sym_hist *h = priv->hist; | 430 | struct sym_hist *h = priv->hist; |
431 | u64 len = sym->end - sym->start, offset; | 431 | u64 len = sym->end - sym->start, offset; |
@@ -439,9 +439,9 @@ static void hist_entry__print_hits(struct hist_entry *self) | |||
439 | 439 | ||
440 | static void annotate_sym(struct hist_entry *he) | 440 | static void annotate_sym(struct hist_entry *he) |
441 | { | 441 | { |
442 | struct map *map = he->map; | 442 | struct map *map = he->ms.map; |
443 | struct dso *dso = map->dso; | 443 | struct dso *dso = map->dso; |
444 | struct symbol *sym = he->sym; | 444 | struct symbol *sym = he->ms.sym; |
445 | const char *filename = dso->long_name, *d_filename; | 445 | const char *filename = dso->long_name, *d_filename; |
446 | u64 len; | 446 | u64 len; |
447 | char command[PATH_MAX*2]; | 447 | char command[PATH_MAX*2]; |
@@ -526,17 +526,17 @@ static void perf_session__find_annotations(struct perf_session *self) | |||
526 | struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node); | 526 | struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node); |
527 | struct sym_priv *priv; | 527 | struct sym_priv *priv; |
528 | 528 | ||
529 | if (he->sym == NULL) | 529 | if (he->ms.sym == NULL) |
530 | continue; | 530 | continue; |
531 | 531 | ||
532 | priv = symbol__priv(he->sym); | 532 | priv = symbol__priv(he->ms.sym); |
533 | if (priv->hist == NULL) | 533 | if (priv->hist == NULL) |
534 | continue; | 534 | continue; |
535 | 535 | ||
536 | annotate_sym(he); | 536 | annotate_sym(he); |
537 | /* | 537 | /* |
538 | * Since we have a hist_entry per IP for the same symbol, free | 538 | * Since we have a hist_entry per IP for the same symbol, free |
539 | * he->sym->hist to signal we already processed this symbol. | 539 | * he->ms.sym->hist to signal we already processed this symbol. |
540 | */ | 540 | */ |
541 | free(priv->hist); | 541 | free(priv->hist); |
542 | priv->hist = NULL; | 542 | priv->hist = NULL; |