aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-annotate.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-annotate.c')
-rw-r--r--tools/perf/builtin-annotate.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 6d63c2eea2c7..77d50a6d6802 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -55,11 +55,11 @@ struct sym_priv {
55 55
56static const char *sym_hist_filter; 56static const char *sym_hist_filter;
57 57
58static int symbol_filter(struct map *map, struct symbol *sym) 58static int symbol_filter(struct map *map __used, struct symbol *sym)
59{ 59{
60 if (sym_hist_filter == NULL || 60 if (sym_hist_filter == NULL ||
61 strcmp(sym->name, sym_hist_filter) == 0) { 61 strcmp(sym->name, sym_hist_filter) == 0) {
62 struct sym_priv *priv = dso__sym_priv(map->dso, sym); 62 struct sym_priv *priv = symbol__priv(sym);
63 const int size = (sizeof(*priv->hist) + 63 const int size = (sizeof(*priv->hist) +
64 (sym->end - sym->start) * sizeof(u64)); 64 (sym->end - sym->start) * sizeof(u64));
65 65
@@ -92,7 +92,7 @@ static void hist_hit(struct hist_entry *he, u64 ip)
92 if (!sym || !he->map) 92 if (!sym || !he->map)
93 return; 93 return;
94 94
95 priv = dso__sym_priv(he->map->dso, sym); 95 priv = symbol__priv(sym);
96 if (!priv->hist) 96 if (!priv->hist)
97 return; 97 return;
98 98
@@ -165,7 +165,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
165 if (map != NULL) { 165 if (map != NULL) {
166got_map: 166got_map:
167 ip = map->map_ip(map, ip); 167 ip = map->map_ip(map, ip);
168 sym = map->dso->find_symbol(map->dso, ip); 168 sym = map__find_symbol(map, ip, symbol_filter);
169 } else { 169 } else {
170 /* 170 /*
171 * If this is outside of all known maps, 171 * If this is outside of all known maps,
@@ -202,8 +202,7 @@ got_map:
202static int 202static int
203process_mmap_event(event_t *event, unsigned long offset, unsigned long head) 203process_mmap_event(event_t *event, unsigned long offset, unsigned long head)
204{ 204{
205 struct map *map = map__new(&event->mmap, NULL, 0, 205 struct map *map = map__new(&event->mmap, NULL, 0);
206 sizeof(struct sym_priv), symbol_filter);
207 struct thread *thread = threads__findnew(event->mmap.pid); 206 struct thread *thread = threads__findnew(event->mmap.pid);
208 207
209 dump_printf("%p [%p]: PERF_RECORD_MMAP %d: [%p(%p) @ %p]: %s\n", 208 dump_printf("%p [%p]: PERF_RECORD_MMAP %d: [%p(%p) @ %p]: %s\n",
@@ -355,7 +354,7 @@ static int parse_line(FILE *file, struct hist_entry *he, u64 len)
355 unsigned int hits = 0; 354 unsigned int hits = 0;
356 double percent = 0.0; 355 double percent = 0.0;
357 const char *color; 356 const char *color;
358 struct sym_priv *priv = dso__sym_priv(he->map->dso, sym); 357 struct sym_priv *priv = symbol__priv(sym);
359 struct sym_ext *sym_ext = priv->ext; 358 struct sym_ext *sym_ext = priv->ext;
360 struct sym_hist *h = priv->hist; 359 struct sym_hist *h = priv->hist;
361 360
@@ -422,7 +421,7 @@ static void insert_source_line(struct sym_ext *sym_ext)
422 421
423static void free_source_line(struct hist_entry *he, int len) 422static void free_source_line(struct hist_entry *he, int len)
424{ 423{
425 struct sym_priv *priv = dso__sym_priv(he->map->dso, he->sym); 424 struct sym_priv *priv = symbol__priv(he->sym);
426 struct sym_ext *sym_ext = priv->ext; 425 struct sym_ext *sym_ext = priv->ext;
427 int i; 426 int i;
428 427
@@ -446,7 +445,7 @@ get_source_line(struct hist_entry *he, int len, const char *filename)
446 int i; 445 int i;
447 char cmd[PATH_MAX * 2]; 446 char cmd[PATH_MAX * 2];
448 struct sym_ext *sym_ext; 447 struct sym_ext *sym_ext;
449 struct sym_priv *priv = dso__sym_priv(he->map->dso, sym); 448 struct sym_priv *priv = symbol__priv(sym);
450 struct sym_hist *h = priv->hist; 449 struct sym_hist *h = priv->hist;
451 450
452 if (!h->sum) 451 if (!h->sum)
@@ -589,7 +588,7 @@ static void find_annotations(void)
589 if (he->sym == NULL) 588 if (he->sym == NULL)
590 continue; 589 continue;
591 590
592 priv = dso__sym_priv(he->map->dso, he->sym); 591 priv = symbol__priv(he->sym);
593 if (priv->hist == NULL) 592 if (priv->hist == NULL)
594 continue; 593 continue;
595 594
@@ -637,7 +636,7 @@ static int __cmd_annotate(void)
637 exit(0); 636 exit(0);
638 } 637 }
639 638
640 if (load_kernel(sizeof(struct sym_priv), symbol_filter) < 0) { 639 if (load_kernel(symbol_filter) < 0) {
641 perror("failed to load kernel symbols"); 640 perror("failed to load kernel symbols");
642 return EXIT_FAILURE; 641 return EXIT_FAILURE;
643 } 642 }
@@ -769,7 +768,7 @@ static void setup_sorting(void)
769 768
770int cmd_annotate(int argc, const char **argv, const char *prefix __used) 769int cmd_annotate(int argc, const char **argv, const char *prefix __used)
771{ 770{
772 symbol__init(); 771 symbol__init(sizeof(struct sym_priv));
773 772
774 page_size = getpagesize(); 773 page_size = getpagesize();
775 774