From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>, Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
LKML <linux-kernel@vger.kernel.org>,
Andi Kleen <ak@linux.intel.com>, Ian Rogers <irogers@google.com>
Subject: [PATCH 3/5] perf report: Show event sample counts in --stat output
Date: Fri, 23 Apr 2021 11:28:11 -0700 [thread overview]
Message-ID: <20210423182813.1472902-4-namhyung@kernel.org> (raw)
In-Reply-To: <20210423182813.1472902-1-namhyung@kernel.org>
To make the output identical with perf report -D, it needs to show
per-event sample counts along with the aggregated stat at the end.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/builtin-report.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index b0b9b60f74e5..be56f3efa413 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -708,9 +708,22 @@ static void report__output_resort(struct report *rep)
ui_progress__finish();
}
+static int count_sample_event(struct perf_tool *tool __maybe_unused,
+ union perf_event *event __maybe_unused,
+ struct perf_sample *sample __maybe_unused,
+ struct evsel *evsel,
+ struct machine *machine __maybe_unused)
+{
+ struct hists *hists = evsel__hists(evsel);
+
+ hists__inc_nr_events(hists);
+ return 0;
+}
+
static void stats_setup(struct report *rep)
{
memset(&rep->tool, 0, sizeof(rep->tool));
+ rep->tool.sample = count_sample_event;
rep->tool.no_warn = true;
}
@@ -719,6 +732,7 @@ static int stats_print(struct report *rep)
struct perf_session *session = rep->session;
perf_session__fprintf_nr_events(session, stdout);
+ perf_evlist__fprintf_nr_events(session->evlist, stdout);
return 0;
}
--
2.31.1.498.g6c1eba8ee3d-goog
next prev parent reply other threads:[~2021-04-23 18:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-23 18:28 [PATCHSET 0/5] perf report: Make --stat output more compact Namhyung Kim
2021-04-23 18:28 ` [PATCH 1/5] perf top: Use evlist->events_stat to count events Namhyung Kim
2021-04-23 18:28 ` [PATCH 2/5] perf hists: Split hists_stats from events_stats Namhyung Kim
2021-04-23 18:28 ` Namhyung Kim [this message]
2021-04-23 18:28 ` [PATCH 4/5] perf report: Add --skip-empty option to suppress 0 event stat Namhyung Kim
2021-04-23 18:28 ` [PATCH 5/5] perf report: Make --skip-empty as default Namhyung Kim
2021-04-23 18:46 ` [PATCHSET 0/5] perf report: Make --stat output more compact Andi Kleen
2021-04-23 19:00 ` Namhyung Kim
2021-04-23 20:20 ` Andi Kleen
2021-04-25 18:07 ` Namhyung Kim
2021-04-26 4:31 ` Andi Kleen
2021-04-26 12:53 ` Arnaldo Carvalho de Melo
2021-04-24 12:23 ` Jiri Olsa
2021-04-25 18:03 ` Namhyung Kim
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=20210423182813.1472902-4-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--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).