summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2018-03-07 16:50:02 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-03-08 11:30:36 -0300
commit8ef278bb9305e1269f236013718801fe06a183d1 (patch)
treea4531e511c90d0540092a23f627c724cf12f0366 /tools/perf/builtin-report.c
parent0b58a77ca8792bd7798ef3a4d865c57694ec74fc (diff)
perf report: Fix the output for stdio events list
Changing the output header for reporting forced groups via --groups option on non grouped events, like: $ perf record -e 'cycles,instructions' $ perf report --stdio --group Before: # Samples: 24 of event 'anon group { cycles:u, instructions:u }' After: # Samples: 24 of events 'cycles:u, instructions:u' Signed-off-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Fixes: ad52b8cb4886 ("perf report: Add support to display group output for non group events") Link: http://lkml.kernel.org/r/20180307155020.32613-2-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 1eedb1815c4c..c3603d4c0c57 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -400,8 +400,10 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
nr_samples = convert_unit(nr_samples, &unit);
ret = fprintf(fp, "# Samples: %lu%c", nr_samples, unit);
- if (evname != NULL)
- ret += fprintf(fp, " of event '%s'", evname);
+ if (evname != NULL) {
+ ret += fprintf(fp, " of event%s '%s'",
+ evsel->nr_members > 1 ? "s" : "", evname);
+ }
if (rep->time_str)
ret += fprintf(fp, " (time slices: %s)", rep->time_str);
@@ -1175,8 +1177,17 @@ repeat:
has_br_stack = perf_header__has_feat(&session->header,
HEADER_BRANCH_STACK);
- if (group_set && !session->evlist->nr_groups)
+ /*
+ * Events in data file are not collect in groups, but we still want
+ * the group display. Set the artificial group and set the leader's
+ * forced_leader flag to notify the display code.
+ */
+ if (group_set && !session->evlist->nr_groups) {
+ struct perf_evsel *leader = perf_evlist__first(session->evlist);
+
perf_evlist__set_leader(session->evlist);
+ leader->forced_leader = true;
+ }
if (itrace_synth_opts.last_branch)
has_br_stack = true;