From: Andi Kleen <andi@firstfloor.org>
To: acme@kernel.org
Cc: jolsa@kernel.org, namhyung@kernel.org,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Andi Kleen <ak@linux.intel.com>
Subject: [PATCH v4 05/15] perf tools report: Parse time quantum
Date: Tue, 5 Mar 2019 06:47:48 -0800 [thread overview]
Message-ID: <20190305144758.12397-6-andi@firstfloor.org> (raw)
In-Reply-To: <20190305144758.12397-1-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
Many workloads change over time. perf report currently aggregates
the whole time range reported in perf.data.
This patch adds an option for a time quantum to quantisize the
perf.data over time.
This just adds the option, will be used in follow on patches
for a time sort key.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
v2:
Move time_quantum to symbol_conf. check for zero time quantum
v3:
Document s unit
---
tools/perf/Documentation/perf-report.txt | 4 +++
tools/perf/builtin-report.c | 41 ++++++++++++++++++++++++
tools/perf/util/symbol.c | 1 +
tools/perf/util/symbol_conf.h | 1 +
4 files changed, 47 insertions(+)
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 51dbc519dbce..9ec1702bccdd 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -497,6 +497,10 @@ include::itrace.txt[]
The period/hits keywords set the base the percentage is computed
on - the samples period or the number of samples (hits).
+--time-quantum::
+ Configure time quantum for time sort key. Default 100ms.
+ Accepts s, us, ms, ns units.
+
include::callchain-overhead-calculation.txt[]
SEE ALSO
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 09180e559ad6..c19952072a3a 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -47,6 +47,7 @@
#include <errno.h>
#include <inttypes.h>
#include <regex.h>
+#include "sane_ctype.h"
#include <signal.h>
#include <linux/bitmap.h>
#include <linux/stringify.h>
@@ -926,6 +927,43 @@ report_parse_callchain_opt(const struct option *opt, const char *arg, int unset)
return parse_callchain_report_opt(arg);
}
+static int
+parse_time_quantum(const struct option *opt, const char *arg,
+ int unset __maybe_unused)
+{
+ unsigned long *time_q = opt->value;
+ char *end;
+
+ *time_q = strtoul(arg, &end, 0);
+ if (end == arg)
+ goto parse_err;
+ if (*time_q == 0) {
+ pr_err("time quantum cannot be 0");
+ return -1;
+ }
+ while (isspace(*end))
+ end++;
+ if (*end == 0)
+ return 0;
+ if (!strcmp(end, "s")) {
+ *time_q *= 1000000000;
+ return 0;
+ }
+ if (!strcmp(end, "ms")) {
+ *time_q *= 1000000;
+ return 0;
+ }
+ if (!strcmp(end, "us")) {
+ *time_q *= 1000;
+ return 0;
+ }
+ if (!strcmp(end, "ns"))
+ return 0;
+parse_err:
+ pr_err("Cannot parse time quantum `%s'\n", arg);
+ return -1;
+}
+
int
report_parse_ignore_callees_opt(const struct option *opt __maybe_unused,
const char *arg, int unset __maybe_unused)
@@ -1148,6 +1186,9 @@ int cmd_report(int argc, const char **argv)
"Set percent type local/global-period/hits",
annotate_parse_percent_type),
OPT_BOOLEAN(0, "ns", &symbol_conf.nanosecs, "Show times in nanosecs"),
+ OPT_CALLBACK(0, "time-quantum", &symbol_conf.time_quantum, "time (ms|us|ns|s)",
+ "Set time quantum for time sort key (default 100ms)",
+ parse_time_quantum),
OPT_END()
};
struct perf_data data = {
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index eb873ea1c405..0f80743a1c25 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -45,6 +45,7 @@ struct symbol_conf symbol_conf = {
.demangle = true,
.demangle_kernel = false,
.cumulate_callchain = true,
+ .time_quantum = 100000000, /* 100ms */
.show_hist_headers = true,
.symfs = "",
.event_group = true,
diff --git a/tools/perf/util/symbol_conf.h b/tools/perf/util/symbol_conf.h
index 095a297c8b47..a5684a71b78e 100644
--- a/tools/perf/util/symbol_conf.h
+++ b/tools/perf/util/symbol_conf.h
@@ -56,6 +56,7 @@ struct symbol_conf {
*sym_list_str,
*col_width_list_str,
*bt_stop_list_str;
+ unsigned long time_quantum;
struct strlist *dso_list,
*comm_list,
*sym_list,
--
2.20.1
next prev parent reply other threads:[~2019-03-05 14:48 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-05 14:47 Support sample context in perf report Andi Kleen
2019-03-05 14:47 ` [PATCH v4 01/15] perf tools: Add utility function to fetch executable Andi Kleen
2019-03-06 20:53 ` Arnaldo Carvalho de Melo
2019-03-06 21:08 ` Andi Kleen
2019-03-09 19:59 ` [tip:perf/urgent] perf thread: Generalize function to copy from thread addr space from intel-bts code tip-bot for Andi Kleen
2019-03-05 14:47 ` [PATCH v4 02/15] perf tools script: Support insn output for normal samples Andi Kleen
2019-03-08 13:37 ` Arnaldo Carvalho de Melo
2019-03-22 21:59 ` [tip:perf/urgent] perf " tip-bot for Andi Kleen
2019-03-05 14:47 ` [PATCH v4 03/15] perf tools script: Filter COMM/FORK/.. events by CPU Andi Kleen
2019-03-06 14:23 ` Adrian Hunter
2019-03-07 11:02 ` Jiri Olsa
2019-03-08 13:39 ` Arnaldo Carvalho de Melo
2019-03-08 15:08 ` Andi Kleen
2019-03-05 14:47 ` [PATCH v4 04/15] perf tools report: Support nano seconds Andi Kleen
2019-03-22 21:59 ` [tip:perf/urgent] perf report: Support output in nanoseconds tip-bot for Andi Kleen
2019-03-05 14:47 ` Andi Kleen [this message]
2019-03-08 13:45 ` [PATCH v4 05/15] perf tools report: Parse time quantum Arnaldo Carvalho de Melo
2019-03-08 13:52 ` Arnaldo Carvalho de Melo
2019-03-08 17:39 ` Andi Kleen
2019-03-22 22:01 ` [tip:perf/urgent] perf " tip-bot for Andi Kleen
2019-03-05 14:47 ` [PATCH v4 06/15] perf tools report: Support time sort key Andi Kleen
2019-03-05 14:47 ` [PATCH v4 07/15] perf tools report: Use less for scripts output Andi Kleen
2019-03-08 13:47 ` Arnaldo Carvalho de Melo
2019-03-09 7:52 ` Feng Tang
2019-03-05 14:47 ` [PATCH v4 08/15] perf tools report: Support running scripts for current time range Andi Kleen
2019-03-05 14:47 ` [PATCH v4 09/15] perf tools report: Support builtin perf script in scripts menu Andi Kleen
2019-03-05 14:47 ` [PATCH v4 10/15] perf tools: Add utility function to print ns time stamps Andi Kleen
2019-03-08 13:51 ` Arnaldo Carvalho de Melo
2019-03-22 22:00 ` [tip:perf/urgent] perf time-utils: Add utility function to print time stamps in nanoseconds tip-bot for Andi Kleen
2019-03-05 14:47 ` [PATCH v4 11/15] perf tools report: Implement browsing of individual samples Andi Kleen
2019-03-05 14:47 ` [PATCH v4 12/15] perf tools: Add some new tips describing the new options Andi Kleen
2019-03-05 14:47 ` [PATCH v4 13/15] perf tools report: Add custom scripts to script menu Andi Kleen
2019-03-05 14:47 ` [PATCH v4 14/15] perf tools script: Add array bound checking to list_scripts Andi Kleen
2019-03-05 14:47 ` [PATCH v4 15/15] perf tools ui: Fix ui popup browser for many entries Andi Kleen
2019-03-07 10:57 ` Support sample context in perf report Jiri Olsa
2019-03-07 16:57 ` Andi Kleen
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=20190305144758.12397-6-andi@firstfloor.org \
--to=andi@firstfloor.org \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=namhyung@kernel.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).