[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240213075256.1983638-5-namhyung@kernel.org>
Date: Mon, 12 Feb 2024 23:52:56 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>,
Ian Rogers <irogers@...gle.com>
Cc: Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
linux-perf-users@...r.kernel.org
Subject: [PATCH 4/4] perf report: Do not show dummy events with --skip-empty
In system-wide mode, a dummy event was added during the perf record to
save various side-band events like FORK, MMAP and so on. But this dummy
event doesn't have samples for itself so it just wastes the output with
all zero values.
When --skip-empty option is on (by default), it can skip those (dummy)
events without any samples by removing them from the evlist. Users can
disable it using --no-skip-empty command line option or setting the
report.skip-empty config option to false.
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
---
tools/perf/Documentation/perf-report.txt | 3 ++-
tools/perf/builtin-report.c | 14 +++++++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index d8b863e01fe0..546af27d209c 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -609,7 +609,8 @@ include::itrace.txt[]
'Avg Cycles' - block average sampled cycles
--skip-empty::
- Do not print 0 results in the --stat output.
+ Do not print 0 results in the output. This means skipping dummy events
+ in the event list and the --stat output.
include::callchain-overhead-calculation.txt[]
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 8e16fa261e6f..60e30f13c8f8 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -752,10 +752,22 @@ static int hists__resort_cb(struct hist_entry *he, void *arg)
static void report__output_resort(struct report *rep)
{
struct ui_progress prog;
- struct evsel *pos;
+ struct evsel *pos, *tmp;
ui_progress__init(&prog, rep->nr_entries, "Sorting events for output...");
+ if (rep->skip_empty) {
+ evlist__for_each_entry_safe(rep->session->evlist, tmp, pos) {
+ struct hists *hists = evsel__hists(pos);
+
+ if (hists->nr_entries != 0)
+ continue;
+
+ evlist__remove(rep->session->evlist, pos);
+ evsel__delete(pos);
+ }
+ }
+
evlist__for_each_entry(rep->session->evlist, pos) {
evsel__output_resort_cb(pos, &prog, hists__resort_cb, rep);
}
--
2.43.0.687.g38aa6559b0-goog
Powered by blists - more mailing lists