From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: namhyung@kernel.org, hpa@zytor.com, dsahern@gmail.com,
ak@linux.intel.com, tglx@linutronix.de, jolsa@kernel.org,
acme@redhat.com, linux-kernel@vger.kernel.org,
alexander.shishkin@linux.intel.com, mingo@kernel.org,
peterz@infradead.org
Subject: [tip:perf/core] perf report: Add --stats option to display quick data statistics
Date: Wed, 10 Jan 2018 22:28:22 -0800 [thread overview]
Message-ID: <tip-a4a4d0a7a2b20f7880262de4f51685baaf693476@git.kernel.org> (raw)
In-Reply-To: <20180107160356.28203-12-jolsa@kernel.org>
Commit-ID: a4a4d0a7a2b20f7880262de4f51685baaf693476
Gitweb: https://git.kernel.org/tip/a4a4d0a7a2b20f7880262de4f51685baaf693476
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Sun, 7 Jan 2018 17:03:55 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 10 Jan 2018 12:00:56 -0300
perf report: Add --stats option to display quick data statistics
Add --stats option to display quick data statistics of event numbers,
without any further processing, like the one at the end of the perf
report -D command.
$ perf report --stat
Aggregated stats:
TOTAL events: 4566
MMAP events: 113
LOST events: 19
COMM events: 3
FORK events: 400
SAMPLE events: 3315
MMAP2 events: 32
FINISHED_ROUND events: 681
THREAD_MAP events: 1
CPU_MAP events: 1
TIME_CONV events: 1
I found this useful when hunting lost events for another change.
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: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20180107160356.28203-12-jolsa@kernel.org
[ Rename it to --stats, plural ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-report.txt | 4 ++++
tools/perf/builtin-report.c | 26 +++++++++++++++++++++++++-
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 1e02c4e..a7d11ef 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -457,6 +457,10 @@ include::itrace.txt[]
will be printed. Each entry is function name or file/line. Enabled by
default, disable with --no-inline.
+--stats::
+ Display overall events statistics without any further processing.
+ (like the one at the end of the perf report -D command)
+
include::callchain-overhead-calculation.txt[]
SEE ALSO
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 770bf8a..8e67a8c 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -62,6 +62,7 @@ struct report {
bool show_threads;
bool inverted_callchain;
bool mem_mode;
+ bool stats_mode;
bool header;
bool header_only;
bool nonany_branch_mode;
@@ -588,6 +589,20 @@ static void report__output_resort(struct report *rep)
ui_progress__finish();
}
+static void stats_setup(struct report *rep)
+{
+ memset(&rep->tool, 0, sizeof(rep->tool));
+ rep->tool.no_warn = true;
+}
+
+static int stats_print(struct report *rep)
+{
+ struct perf_session *session = rep->session;
+
+ perf_session__fprintf_nr_events(session, stdout);
+ return 0;
+}
+
static int __cmd_report(struct report *rep)
{
int ret;
@@ -619,12 +634,18 @@ static int __cmd_report(struct report *rep)
return ret;
}
+ if (rep->stats_mode)
+ stats_setup(rep);
+
ret = perf_session__process_events(session);
if (ret) {
ui__error("failed to process sample\n");
return ret;
}
+ if (rep->stats_mode)
+ return stats_print(rep);
+
report__warn_kptr_restrict(rep);
evlist__for_each_entry(session->evlist, pos)
@@ -781,6 +802,7 @@ int cmd_report(int argc, const char **argv)
OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"),
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
+ OPT_BOOLEAN(0, "stats", &report.stats_mode, "Display event stats"),
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
"file", "vmlinux pathname"),
OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name,
@@ -1042,6 +1064,8 @@ repeat:
report.tool.show_feat_hdr = SHOW_FEAT_HEADER;
if (report.show_full_info)
report.tool.show_feat_hdr = SHOW_FEAT_HEADER_FULL_INFO;
+ if (report.stats_mode)
+ use_browser = 0;
if (strcmp(input_name, "-") != 0)
setup_browser(true);
@@ -1064,7 +1088,7 @@ repeat:
ret = 0;
goto error;
}
- } else if (use_browser == 0 && !quiet) {
+ } else if (use_browser == 0 && !quiet && !report.stats_mode) {
fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n",
stdout);
}
next prev parent reply other threads:[~2018-01-11 6:31 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-07 16:03 [PATCH 00/12] perf: Assorted fixes Jiri Olsa
2018-01-07 16:03 ` [PATCH 01/12] perf tools: Enable LIBBABELTRACE by default Jiri Olsa
2018-01-08 15:17 ` Arnaldo Carvalho de Melo
2018-01-08 15:20 ` Arnaldo Carvalho de Melo
2018-01-08 15:24 ` Arnaldo Carvalho de Melo
2018-01-08 17:11 ` Jiri Olsa
2018-01-08 17:16 ` Jiri Olsa
2018-01-09 9:26 ` [PATCH] perf build: Display EXTRA features for VF=1 build Jiri Olsa
2018-01-19 10:15 ` Jiri Olsa
2018-01-19 12:43 ` Arnaldo Carvalho de Melo
2018-01-24 11:23 ` [tip:perf/core] " tip-bot for Jiri Olsa
2018-01-11 6:24 ` [tip:perf/core] perf tools: Enable LIBBABELTRACE by default tip-bot for Jiri Olsa
2018-01-07 16:03 ` [PATCH 02/12] perf tools: Display perf_event_attr::namespaces debug info Jiri Olsa
2018-01-11 6:24 ` [tip:perf/core] " tip-bot for Jiri Olsa
2018-01-07 16:03 ` [PATCH 03/12] perf: Allocate context task_ctx_data for child event Jiri Olsa
2018-01-08 12:14 ` Peter Zijlstra
2018-01-11 6:24 ` [tip:perf/core] " tip-bot for Jiri Olsa
2018-01-07 16:03 ` [PATCH 04/12] perf: Add sample_id to PERF_RECORD_ITRACE_START event comment Jiri Olsa
2018-01-11 6:25 ` [tip:perf/core] " tip-bot for Jiri Olsa
2018-01-07 16:03 ` [PATCH 05/12] perf: Make perf_callchain function static Jiri Olsa
2018-01-11 6:25 ` [tip:perf/core] " tip-bot for Jiri Olsa
2018-01-07 16:03 ` [PATCH 06/12] perf: Return empty callchain instead of NULL Jiri Olsa
2018-01-08 12:15 ` Peter Zijlstra
2018-01-11 6:26 ` [tip:perf/core] " tip-bot for Jiri Olsa
2018-01-07 16:03 ` [PATCH 07/12] perf: Update PERF_RECORD_MISC_* comment for perf_event_header::misc bit 13 Jiri Olsa
2018-01-11 6:26 ` [tip:perf/core] " tip-bot for Jiri Olsa
2018-01-07 16:03 ` [PATCH 08/12] perf script: Add support to display sample misc field Jiri Olsa
2018-01-11 6:27 ` [tip:perf/core] " tip-bot for Jiri Olsa
2018-01-07 16:03 ` [PATCH 09/12] perf script: Add support to display lost events Jiri Olsa
2018-01-10 15:40 ` Arnaldo Carvalho de Melo
2018-01-10 15:44 ` Jiri Olsa
2018-01-11 6:27 ` [tip:perf/core] " tip-bot for Jiri Olsa
2018-01-07 16:03 ` [PATCH 10/12] perf tools: Make the tool's warning messages optional Jiri Olsa
2018-01-11 6:27 ` [tip:perf/core] " tip-bot for Jiri Olsa
2018-01-07 16:03 ` [PATCH 11/12] perf report: Add --stat option to display quick data statistics Jiri Olsa
2018-01-11 6:28 ` tip-bot for Jiri Olsa [this message]
2018-01-07 16:03 ` [PATCH 12/12] perf report: Add --task option to display monitored tasks Jiri Olsa
2018-01-08 15:55 ` Arnaldo Carvalho de Melo
2018-01-08 16:03 ` Arnaldo Carvalho de Melo
2018-01-09 1:56 ` Namhyung Kim
2018-01-09 9:15 ` Jiri Olsa
2018-01-09 13:05 ` Arnaldo Carvalho de Melo
2018-01-09 13:27 ` Jiri Olsa
2018-01-11 6:29 ` [tip:perf/core] perf report: Add --tasks " tip-bot for Jiri Olsa
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=tip-a4a4d0a7a2b20f7880262de4f51685baaf693476@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.