aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/ui
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-02-04 10:43:24 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-02-05 09:28:48 -0500
commit2f525d0148ef2734c8a172201e5e1e9167a8a5fd (patch)
tree6bd0efbdeb640fa52616b20f03aed7176eb6c297 /tools/perf/util/ui
parent78f7defedbb4da73b9a07635c357c1afcaa55c8f (diff)
perf annotate: Support multiple histograms in annotation
The perf annotate tool continues aggregating everything on just one histograms, but to support the top model add support for one histogram perf evsel in the evlist. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/ui')
-rw-r--r--tools/perf/util/ui/browsers/annotate.c12
-rw-r--r--tools/perf/util/ui/browsers/hists.c9
2 files changed, 11 insertions, 10 deletions
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index daa7138d8015..8d8a16895af7 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -61,7 +61,7 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
61 61
62static double objdump_line__calc_percent(struct objdump_line *self, 62static double objdump_line__calc_percent(struct objdump_line *self,
63 struct list_head *head, 63 struct list_head *head,
64 struct symbol *sym) 64 struct symbol *sym, int evidx)
65{ 65{
66 double percent = 0.0; 66 double percent = 0.0;
67 67
@@ -70,7 +70,7 @@ static double objdump_line__calc_percent(struct objdump_line *self,
70 unsigned int hits = 0; 70 unsigned int hits = 0;
71 struct annotation *notes = symbol__annotation(sym); 71 struct annotation *notes = symbol__annotation(sym);
72 struct source_line *src_line = notes->src_line; 72 struct source_line *src_line = notes->src_line;
73 struct sym_hist *h = notes->histogram; 73 struct sym_hist *h = annotation__histogram(notes, evidx);
74 s64 offset = self->offset; 74 s64 offset = self->offset;
75 struct objdump_line *next = objdump__get_next_ip_line(head, self); 75 struct objdump_line *next = objdump__get_next_ip_line(head, self);
76 76
@@ -183,12 +183,12 @@ out:
183 return key; 183 return key;
184} 184}
185 185
186int hist_entry__tui_annotate(struct hist_entry *he) 186int hist_entry__tui_annotate(struct hist_entry *he, int evidx)
187{ 187{
188 return symbol__tui_annotate(he->ms.sym, he->ms.map); 188 return symbol__tui_annotate(he->ms.sym, he->ms.map, evidx);
189} 189}
190 190
191int symbol__tui_annotate(struct symbol *sym, struct map *map) 191int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx)
192{ 192{
193 struct objdump_line *pos, *n; 193 struct objdump_line *pos, *n;
194 struct objdump_line_rb_node *rbpos; 194 struct objdump_line_rb_node *rbpos;
@@ -223,7 +223,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map)
223 browser.b.width = line_len; 223 browser.b.width = line_len;
224 rbpos = objdump_line__rb(pos); 224 rbpos = objdump_line__rb(pos);
225 rbpos->idx = browser.b.nr_entries++; 225 rbpos->idx = browser.b.nr_entries++;
226 rbpos->percent = objdump_line__calc_percent(pos, &head, sym); 226 rbpos->percent = objdump_line__calc_percent(pos, &head, sym, evidx);
227 if (rbpos->percent < 0.01) 227 if (rbpos->percent < 0.01)
228 continue; 228 continue;
229 objdump__insert_line(&browser.entries, rbpos); 229 objdump__insert_line(&browser.entries, rbpos);
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index 86428239fa65..294b49538522 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -797,7 +797,8 @@ static int hists__browser_title(struct hists *self, char *bf, size_t size,
797 return printed; 797 return printed;
798} 798}
799 799
800int hists__browse(struct hists *self, const char *helpline, const char *ev_name) 800int hists__browse(struct hists *self, const char *helpline,
801 const char *ev_name, int evidx)
801{ 802{
802 struct hist_browser *browser = hist_browser__new(self); 803 struct hist_browser *browser = hist_browser__new(self);
803 struct pstack *fstack; 804 struct pstack *fstack;
@@ -935,7 +936,7 @@ do_annotate:
935 if (he == NULL) 936 if (he == NULL)
936 continue; 937 continue;
937 938
938 hist_entry__tui_annotate(he); 939 hist_entry__tui_annotate(he, evidx);
939 } else if (choice == browse_map) 940 } else if (choice == browse_map)
940 map__browse(browser->selection->map); 941 map__browse(browser->selection->map);
941 else if (choice == zoom_dso) { 942 else if (choice == zoom_dso) {
@@ -984,7 +985,7 @@ out:
984 return key; 985 return key;
985} 986}
986 987
987int hists__tui_browse_tree(struct rb_root *self, const char *help) 988int hists__tui_browse_tree(struct rb_root *self, const char *help, int evidx)
988{ 989{
989 struct rb_node *first = rb_first(self), *nd = first, *next; 990 struct rb_node *first = rb_first(self), *nd = first, *next;
990 int key = 0; 991 int key = 0;
@@ -993,7 +994,7 @@ int hists__tui_browse_tree(struct rb_root *self, const char *help)
993 struct hists *hists = rb_entry(nd, struct hists, rb_node); 994 struct hists *hists = rb_entry(nd, struct hists, rb_node);
994 const char *ev_name = __event_name(hists->type, hists->config); 995 const char *ev_name = __event_name(hists->type, hists->config);
995 996
996 key = hists__browse(hists, help, ev_name); 997 key = hists__browse(hists, help, ev_name, evidx);
997 switch (key) { 998 switch (key) {
998 case NEWT_KEY_TAB: 999 case NEWT_KEY_TAB:
999 next = rb_next(nd); 1000 next = rb_next(nd);