aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-annotate.c
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/builtin-annotate.c
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/builtin-annotate.c')
-rw-r--r--tools/perf/builtin-annotate.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 9072ef44cfcb..f3e44231b10d 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -57,7 +57,18 @@ static int hists__add_entry(struct hists *self, struct addr_location *al)
57 if (he == NULL) 57 if (he == NULL)
58 return -ENOMEM; 58 return -ENOMEM;
59 59
60 return hist_entry__inc_addr_samples(he, al->addr); 60 if (he->ms.sym != NULL) {
61 /*
62 * All aggregated on the first sym_hist.
63 */
64 struct annotation *notes = symbol__annotation(he->ms.sym);
65 if (notes->histograms == NULL && symbol__alloc_hist(he->ms.sym, 1) < 0)
66 return -ENOMEM;
67
68 return hist_entry__inc_addr_samples(he, 0, al->addr);
69 }
70
71 return 0;
61} 72}
62 73
63static int process_sample_event(union perf_event *event, 74static int process_sample_event(union perf_event *event,
@@ -81,9 +92,9 @@ static int process_sample_event(union perf_event *event,
81 return 0; 92 return 0;
82} 93}
83 94
84static int hist_entry__tty_annotate(struct hist_entry *he) 95static int hist_entry__tty_annotate(struct hist_entry *he, int evidx)
85{ 96{
86 return symbol__tty_annotate(he->ms.sym, he->ms.map, 97 return symbol__tty_annotate(he->ms.sym, he->ms.map, evidx,
87 print_line, full_paths); 98 print_line, full_paths);
88} 99}
89 100
@@ -100,7 +111,7 @@ static void hists__find_annotations(struct hists *self)
100 goto find_next; 111 goto find_next;
101 112
102 notes = symbol__annotation(he->ms.sym); 113 notes = symbol__annotation(he->ms.sym);
103 if (notes->histogram == NULL) { 114 if (notes->histograms == NULL) {
104find_next: 115find_next:
105 if (key == KEY_LEFT) 116 if (key == KEY_LEFT)
106 nd = rb_prev(nd); 117 nd = rb_prev(nd);
@@ -110,7 +121,8 @@ find_next:
110 } 121 }
111 122
112 if (use_browser > 0) { 123 if (use_browser > 0) {
113 key = hist_entry__tui_annotate(he); 124 /* For now all is aggregated on the first */
125 key = hist_entry__tui_annotate(he, 0);
114 switch (key) { 126 switch (key) {
115 case KEY_RIGHT: 127 case KEY_RIGHT:
116 next = rb_next(nd); 128 next = rb_next(nd);
@@ -125,15 +137,16 @@ find_next:
125 if (next != NULL) 137 if (next != NULL)
126 nd = next; 138 nd = next;
127 } else { 139 } else {
128 hist_entry__tty_annotate(he); 140 /* For now all is aggregated on the first */
141 hist_entry__tty_annotate(he, 0);
129 nd = rb_next(nd); 142 nd = rb_next(nd);
130 /* 143 /*
131 * Since we have a hist_entry per IP for the same 144 * Since we have a hist_entry per IP for the same
132 * symbol, free he->ms.sym->histogram to signal we already 145 * symbol, free he->ms.sym->histogram to signal we already
133 * processed this symbol. 146 * processed this symbol.
134 */ 147 */
135 free(notes->histogram); 148 free(notes->histograms);
136 notes->histogram = NULL; 149 notes->histograms = NULL;
137 } 150 }
138 } 151 }
139} 152}