diff options
Diffstat (limited to 'tools/perf/builtin-annotate.c')
-rw-r--r-- | tools/perf/builtin-annotate.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 2e6961ea3184..db491e9a812b 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -63,7 +63,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel, | |||
63 | return 0; | 63 | return 0; |
64 | } | 64 | } |
65 | 65 | ||
66 | he = __hists__add_entry(&evsel->hists, al, NULL, 1); | 66 | he = __hists__add_entry(&evsel->hists, al, NULL, 1, 1); |
67 | if (he == NULL) | 67 | if (he == NULL) |
68 | return -ENOMEM; | 68 | return -ENOMEM; |
69 | 69 | ||
@@ -109,14 +109,16 @@ static int process_sample_event(struct perf_tool *tool, | |||
109 | return 0; | 109 | return 0; |
110 | } | 110 | } |
111 | 111 | ||
112 | static int hist_entry__tty_annotate(struct hist_entry *he, int evidx, | 112 | static int hist_entry__tty_annotate(struct hist_entry *he, |
113 | struct perf_evsel *evsel, | ||
113 | struct perf_annotate *ann) | 114 | struct perf_annotate *ann) |
114 | { | 115 | { |
115 | return symbol__tty_annotate(he->ms.sym, he->ms.map, evidx, | 116 | return symbol__tty_annotate(he->ms.sym, he->ms.map, evsel, |
116 | ann->print_line, ann->full_paths, 0, 0); | 117 | ann->print_line, ann->full_paths, 0, 0); |
117 | } | 118 | } |
118 | 119 | ||
119 | static void hists__find_annotations(struct hists *self, int evidx, | 120 | static void hists__find_annotations(struct hists *self, |
121 | struct perf_evsel *evsel, | ||
120 | struct perf_annotate *ann) | 122 | struct perf_annotate *ann) |
121 | { | 123 | { |
122 | struct rb_node *nd = rb_first(&self->entries), *next; | 124 | struct rb_node *nd = rb_first(&self->entries), *next; |
@@ -142,14 +144,14 @@ find_next: | |||
142 | if (use_browser == 2) { | 144 | if (use_browser == 2) { |
143 | int ret; | 145 | int ret; |
144 | 146 | ||
145 | ret = hist_entry__gtk_annotate(he, evidx, NULL); | 147 | ret = hist_entry__gtk_annotate(he, evsel, NULL); |
146 | if (!ret || !ann->skip_missing) | 148 | if (!ret || !ann->skip_missing) |
147 | return; | 149 | return; |
148 | 150 | ||
149 | /* skip missing symbols */ | 151 | /* skip missing symbols */ |
150 | nd = rb_next(nd); | 152 | nd = rb_next(nd); |
151 | } else if (use_browser == 1) { | 153 | } else if (use_browser == 1) { |
152 | key = hist_entry__tui_annotate(he, evidx, NULL); | 154 | key = hist_entry__tui_annotate(he, evsel, NULL); |
153 | switch (key) { | 155 | switch (key) { |
154 | case -1: | 156 | case -1: |
155 | if (!ann->skip_missing) | 157 | if (!ann->skip_missing) |
@@ -168,7 +170,7 @@ find_next: | |||
168 | if (next != NULL) | 170 | if (next != NULL) |
169 | nd = next; | 171 | nd = next; |
170 | } else { | 172 | } else { |
171 | hist_entry__tty_annotate(he, evidx, ann); | 173 | hist_entry__tty_annotate(he, evsel, ann); |
172 | nd = rb_next(nd); | 174 | nd = rb_next(nd); |
173 | /* | 175 | /* |
174 | * Since we have a hist_entry per IP for the same | 176 | * Since we have a hist_entry per IP for the same |
@@ -230,7 +232,12 @@ static int __cmd_annotate(struct perf_annotate *ann) | |||
230 | total_nr_samples += nr_samples; | 232 | total_nr_samples += nr_samples; |
231 | hists__collapse_resort(hists); | 233 | hists__collapse_resort(hists); |
232 | hists__output_resort(hists); | 234 | hists__output_resort(hists); |
233 | hists__find_annotations(hists, pos->idx, ann); | 235 | |
236 | if (symbol_conf.event_group && | ||
237 | !perf_evsel__is_group_leader(pos)) | ||
238 | continue; | ||
239 | |||
240 | hists__find_annotations(hists, pos, ann); | ||
234 | } | 241 | } |
235 | } | 242 | } |
236 | 243 | ||
@@ -312,6 +319,8 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused) | |||
312 | "Specify disassembler style (e.g. -M intel for intel syntax)"), | 319 | "Specify disassembler style (e.g. -M intel for intel syntax)"), |
313 | OPT_STRING(0, "objdump", &objdump_path, "path", | 320 | OPT_STRING(0, "objdump", &objdump_path, "path", |
314 | "objdump binary to use for disassembly and annotations"), | 321 | "objdump binary to use for disassembly and annotations"), |
322 | OPT_BOOLEAN(0, "group", &symbol_conf.event_group, | ||
323 | "Show event group information together"), | ||
315 | OPT_END() | 324 | OPT_END() |
316 | }; | 325 | }; |
317 | 326 | ||