diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index efcadb7620b8..1bfe41783a7c 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -632,12 +632,22 @@ static int __cmd_annotate(struct perf_annotate *ann) evlist__for_each_entry(session->evlist, pos) { struct hists *hists = evsel__hists(pos); u32 nr_samples = hists->stats.nr_samples; + struct ui_progress prog; + struct evsel *evsel; + + if (!symbol_conf.event_group || !evsel__is_group_leader(pos)) + continue; + + for_each_group_member(evsel, pos) + nr_samples += evsel__hists(evsel)->stats.nr_samples; if (nr_samples == 0) continue; - if (!symbol_conf.event_group || !evsel__is_group_leader(pos)) - continue; + ui_progress__init(&prog, nr_samples, + "Sorting group events for output..."); + evsel__output_resort(pos, &prog); + ui_progress__finish(); hists__find_annotations(hists, pos, ann); }