From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org
Subject: [PATCH 4/4] perf report: Do not show dummy events with --skip-empty
Date: Mon, 12 Feb 2024 23:52:56 -0800 [thread overview]
Message-ID: <20240213075256.1983638-5-namhyung@kernel.org> (raw)
In-Reply-To: <20240213075256.1983638-1-namhyung@kernel.org>
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@kernel.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
prev parent reply other threads:[~2024-02-13 7:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 7:52 [PATCHSET 0/4] perf report: Omit dummy events in the output (v1) Namhyung Kim
2024-02-13 7:52 ` [PATCH 1/4] libperf evlist: Update group info in perf_evlist__remove() Namhyung Kim
2024-02-14 23:50 ` Ian Rogers
2024-02-15 5:16 ` Namhyung Kim
2024-02-13 7:52 ` [PATCH 2/4] perf hist: Simplify hist printing logic for group events Namhyung Kim
2024-02-14 23:57 ` Ian Rogers
2024-02-15 5:18 ` Namhyung Kim
2024-02-13 7:52 ` [PATCH 3/4] perf hist: Do not use event index in hpp__fmt() Namhyung Kim
2024-02-15 0:08 ` Ian Rogers
2024-02-15 5:26 ` Namhyung Kim
2024-02-15 7:54 ` Ian Rogers
2024-02-16 20:08 ` Namhyung Kim
2024-02-13 7:52 ` Namhyung Kim [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240213075256.1983638-5-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).