Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1532562
| From | David Ahern <dsa@cumulusnetworks.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 6/6] perf report: Add option to specify time window of interest |
| Date | 2016-11-29 18:20 +0100 |
| Message-ID | <sIUeu-2Xs-33@gated-at.bofh.it> (permalink) |
| References | <sIUeu-2Xs-27@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Add option to allow user to control analysis window. e.g., collect data
for time window and analyze a segment of interest within that window.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
tools/perf/Documentation/perf-report.txt | 7 +++++++
tools/perf/builtin-report.c | 14 +++++++++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 2d1746295abf..3a166ae4a4d3 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -382,6 +382,13 @@ OPTIONS
--header-only::
Show only perf.data header (forces --stdio).
+--time::
+ Only analyze samples within given time window: <start>,<stop>. Times
+ have the format seconds.microseconds. If start is not given (i.e., time
+ string is ',x.y') then analysis starts at the beginning of the file. If
+ stop time is not given (i.e, time string is 'x.y,') then analysis goes
+ to end of file.
+
--itrace::
Options for decoding instruction tracing data. The options are:
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 3dfbfffe2ecd..d2afbe4a240d 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -36,7 +36,7 @@
#include "util/hist.h"
#include "util/data.h"
#include "arch/common.h"
-
+#include "util/time-utils.h"
#include "util/auxtrace.h"
#include <dlfcn.h>
@@ -59,6 +59,8 @@ struct report {
const char *pretty_printing_style;
const char *cpu_list;
const char *symbol_filter_str;
+ const char *time_str;
+ struct perf_time_interval ptime;
float min_percent;
u64 nr_entries;
u64 queue_size;
@@ -158,6 +160,9 @@ static int process_sample_event(struct perf_tool *tool,
};
int ret = 0;
+ if (perf_time__skip_sample(&rep->ptime, sample->time))
+ return 0;
+
if (machine__resolve(machine, &al, sample) < 0) {
pr_debug("problem processing %d event, skipping it.\n",
event->header.type);
@@ -830,6 +835,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_CALLBACK_DEFAULT(0, "stdio-color", NULL, "mode",
"'always' (default), 'never' or 'auto' only applicable to --stdio mode",
stdio__config_color, "always"),
+ OPT_STRING(0, "time", &report.time_str, "str",
+ "Time span of interest (start,stop)"),
OPT_END()
};
struct perf_data_file file = {
@@ -1015,6 +1022,11 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
if (symbol__init(&session->header.env) < 0)
goto error;
+ if (perf_time__parse_str(&report.ptime, report.time_str) != 0) {
+ pr_err("Invalid time string\n");
+ return -EINVAL;
+ }
+
sort__setup_elide(stdout);
ret = __cmd_report(&report);
--
2.7.4 (Apple Git-66)
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/6] perf: Add option to specify time window of interest David Ahern <dsa@cumulusnetworks.com> - 2016-11-29 18:20 +0100
[PATCH v2 6/6] perf report: Add option to specify time window of interest David Ahern <dsa@cumulusnetworks.com> - 2016-11-29 18:20 +0100
[tip:perf/core] perf report: Add option to specify time window of interest tip-bot for David Ahern <tipbot@zytor.com> - 2016-12-02 11:50 +0100
[PATCH v2 5/6] perf kmem: Add option to specify time window of interest David Ahern <dsa@cumulusnetworks.com> - 2016-11-29 18:20 +0100
[tip:perf/core] perf kmem: Add option to specify time window of interest tip-bot for David Ahern <tipbot@zytor.com> - 2016-12-02 11:50 +0100
[PATCH v2 4/6] perf sched timehist: Add option to specify time window of interest David Ahern <dsa@cumulusnetworks.com> - 2016-11-29 18:20 +0100
Re: [PATCH v2 4/6] perf sched timehist: Add option to specify time window of interest Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-11-29 20:00 +0100
Re: [PATCH v2 4/6] perf sched timehist: Add option to specify time window of interest David Ahern <dsahern@gmail.com> - 2016-11-29 20:00 +0100
Re: [PATCH v2 4/6] perf sched timehist: Add option to specify time window of interest Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-11-29 20:30 +0100
[tip:perf/core] perf sched timehist: Add option to specify time window of interest tip-bot for David Ahern <tipbot@zytor.com> - 2016-12-02 11:50 +0100
[PATCH v2 3/6] perf script: Add option to specify time window of interest David Ahern <dsa@cumulusnetworks.com> - 2016-11-29 18:20 +0100
[tip:perf/core] perf script: Add option to specify time window of interest tip-bot for David Ahern <tipbot@zytor.com> - 2016-12-02 11:50 +0100
[PATCH v2 2/6] perf tool: Move parse_nsec_time to time-utils.c David Ahern <dsa@cumulusnetworks.com> - 2016-11-29 18:20 +0100
[tip:perf/core] perf tools: Move parse_nsec_time to time-utils.c tip-bot for David Ahern <tipbot@zytor.com> - 2016-12-02 11:50 +0100
[PATCH v2 1/6] perf tool: Add time-based utility functions David Ahern <dsa@cumulusnetworks.com> - 2016-11-29 18:30 +0100
[tip:perf/core] perf tools: Add time-based utility functions tip-bot for David Ahern <tipbot@zytor.com> - 2016-12-02 11:50 +0100
Re: [PATCH v2 0/6] perf: Add option to specify time window of interest Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-11-29 20:20 +0100
Re: [PATCH v2 0/6] perf: Add option to specify time window of interest Namhyung Kim <namhyung@kernel.org> - 2016-11-30 06:30 +0100
Re: [PATCH v2 0/6] perf: Add option to specify time window of interest Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-11-30 15:30 +0100
csiph-web