aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-annotate.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-10-30 14:28:24 -0400
committerIngo Molnar <mingo@elte.hu>2009-11-02 10:52:11 -0500
commit00a192b395b0606ad0265243844b3cd68e73420a (patch)
tree09149f550807c365f170c857b1021d66e5bb8b4b /tools/perf/builtin-annotate.c
parentafb7b4f08e274cecd8337f9444affa288a9cd4c1 (diff)
perf tools: Simplify the symbol priv area mechanism
Before we were storing this in the DSO, but in fact this is a property of the 'symbol' class, not something that will vary among DSOs, so move it to a global variable and initialize it using the existing symbol__init routine. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Mike Galbraith <efault@gmx.de> LKML-Reference: <1256927305-4628-2-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.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 8688bfee42ab..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
@@ -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));
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