public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf, tools, record: Support recording running/enabled time
@ 2015-02-24 23:13 Andi Kleen
  2015-02-25 15:13 ` Jiri Olsa
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andi Kleen @ 2015-02-24 23:13 UTC (permalink / raw)
  To: acme; +Cc: jolsa, linux-kernel, namhyung, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

Add an option to perf record to record running/enabled time
for read events, similar to what stat does.

This is useful to understand multiplexing problems.

Right now the report support is not great, but at least
report -D already supports it.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 tools/perf/Documentation/perf-record.txt | 3 +++
 tools/perf/builtin-record.c              | 2 ++
 tools/perf/perf.h                        | 1 +
 tools/perf/util/evsel.c                  | 6 ++++++
 4 files changed, 12 insertions(+)

diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index 1c7e50f..f293e96 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -241,6 +241,9 @@ Capture machine state (registers) at interrupt, i.e., on counter overflows for
 each sample. List of captured registers depends on the architecture. This option
 is off by default.
 
+--running::
+Record running and enabled time for read events (:S)
+
 SEE ALSO
 --------
 linkperf:perf-stat[1], linkperf:perf-list[1]
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index d0d02a8..4fdad06 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -839,6 +839,8 @@ struct option __record_options[] = {
 		    "use per-thread mmaps"),
 	OPT_BOOLEAN('I', "intr-regs", &record.opts.sample_intr_regs,
 		    "Sample machine registers on interrupt"),
+	OPT_BOOLEAN(0, "running-time", &record.opts.running_time,
+		    "Record running/enabled time of read (:S) events"),
 	OPT_END()
 };
 
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 1dabb85..1caa70a 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -53,6 +53,7 @@ struct record_opts {
 	bool	     sample_time;
 	bool	     period;
 	bool	     sample_intr_regs;
+	bool	     running_time;
 	unsigned int freq;
 	unsigned int mmap_pages;
 	unsigned int user_freq;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index f93e520..bb4eff2 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -734,6 +734,12 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)
 	if (opts->sample_transaction)
 		perf_evsel__set_sample_bit(evsel, TRANSACTION);
 
+	if (opts->running_time) {
+		evsel->attr.read_format |=
+			PERF_FORMAT_TOTAL_TIME_ENABLED |
+			PERF_FORMAT_TOTAL_TIME_RUNNING;
+	}
+
 	/*
 	 * XXX see the function comment above
 	 *
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf, tools, record: Support recording running/enabled time
  2015-02-24 23:13 [PATCH] perf, tools, record: Support recording running/enabled time Andi Kleen
@ 2015-02-25 15:13 ` Jiri Olsa
  2015-02-25 15:42   ` Arnaldo Carvalho de Melo
  2015-02-25 16:47 ` David Ahern
  2015-02-26 11:35 ` [tip:perf/core] perf record: Support recording running/ enabled time tip-bot for Andi Kleen
  2 siblings, 1 reply; 5+ messages in thread
From: Jiri Olsa @ 2015-02-25 15:13 UTC (permalink / raw)
  To: Andi Kleen; +Cc: acme, linux-kernel, namhyung, Andi Kleen

On Tue, Feb 24, 2015 at 03:13:40PM -0800, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
> 
> Add an option to perf record to record running/enabled time
> for read events, similar to what stat does.
> 
> This is useful to understand multiplexing problems.
> 
> Right now the report support is not great, but at least
> report -D already supports it.

yep, report -D displays it nicely

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf, tools, record: Support recording running/enabled time
  2015-02-25 15:13 ` Jiri Olsa
@ 2015-02-25 15:42   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-02-25 15:42 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: Andi Kleen, linux-kernel, namhyung, Andi Kleen

Em Wed, Feb 25, 2015 at 04:13:06PM +0100, Jiri Olsa escreveu:
> On Tue, Feb 24, 2015 at 03:13:40PM -0800, Andi Kleen wrote:
> > From: Andi Kleen <ak@linux.intel.com>
> > 
> > Add an option to perf record to record running/enabled time
> > for read events, similar to what stat does.
> > 
> > This is useful to understand multiplexing problems.
> > 
> > Right now the report support is not great, but at least
> > report -D already supports it.
> 
> yep, report -D displays it nicely
> 
> Acked-by: Jiri Olsa <jolsa@kernel.org>

Thanks, applied.

- Arnaldo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf, tools, record: Support recording running/enabled time
  2015-02-24 23:13 [PATCH] perf, tools, record: Support recording running/enabled time Andi Kleen
  2015-02-25 15:13 ` Jiri Olsa
@ 2015-02-25 16:47 ` David Ahern
  2015-02-26 11:35 ` [tip:perf/core] perf record: Support recording running/ enabled time tip-bot for Andi Kleen
  2 siblings, 0 replies; 5+ messages in thread
From: David Ahern @ 2015-02-25 16:47 UTC (permalink / raw)
  To: Andi Kleen, acme; +Cc: jolsa, linux-kernel, namhyung, Andi Kleen

On 2/24/15 4:13 PM, Andi Kleen wrote:
> --- a/tools/perf/Documentation/perf-record.txt
> +++ b/tools/perf/Documentation/perf-record.txt
> @@ -241,6 +241,9 @@ Capture machine state (registers) at interrupt, i.e., on counter overflows for
>   each sample. List of captured registers depends on the architecture. This option
>   is off by default.
>
> +--running::
> +Record running and enabled time for read events (:S)
> +
>   SEE ALSO
>   --------
>   linkperf:perf-stat[1], linkperf:perf-list[1]
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index d0d02a8..4fdad06 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -839,6 +839,8 @@ struct option __record_options[] = {
>   		    "use per-thread mmaps"),
>   	OPT_BOOLEAN('I', "intr-regs", &record.opts.sample_intr_regs,
>   		    "Sample machine registers on interrupt"),
> +	OPT_BOOLEAN(0, "running-time", &record.opts.running_time,
> +		    "Record running/enabled time of read (:S) events"),
>   	OPT_END()

Documentation differs from option in the record command.

David


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip:perf/core] perf record: Support recording running/ enabled time
  2015-02-24 23:13 [PATCH] perf, tools, record: Support recording running/enabled time Andi Kleen
  2015-02-25 15:13 ` Jiri Olsa
  2015-02-25 16:47 ` David Ahern
@ 2015-02-26 11:35 ` tip-bot for Andi Kleen
  2 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Andi Kleen @ 2015-02-26 11:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, linux-kernel, tglx, ak, hpa, acme, namhyung, jolsa

Commit-ID:  85c273d2b6569706762cf400079ca0699e007d81
Gitweb:     http://git.kernel.org/tip/85c273d2b6569706762cf400079ca0699e007d81
Author:     Andi Kleen <ak@linux.intel.com>
AuthorDate: Tue, 24 Feb 2015 15:13:40 -0800
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 25 Feb 2015 12:42:23 -0300

perf record: Support recording running/enabled time

Add an option to perf record to record running/enabled time for read
events, similar to what stat does.

This is useful to understand multiplexing problems.

Right now the report support is not great, but at least report -D
already supports it.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1424819620-16043-1-git-send-email-andi@firstfloor.org
[ Fixed the Documentation entry to match the OPT_BOOLEAN one ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-record.txt | 3 +++
 tools/perf/builtin-record.c              | 2 ++
 tools/perf/perf.h                        | 1 +
 tools/perf/util/evsel.c                  | 6 ++++++
 4 files changed, 12 insertions(+)

diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index 1c7e50f..cae75c1 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -241,6 +241,9 @@ Capture machine state (registers) at interrupt, i.e., on counter overflows for
 each sample. List of captured registers depends on the architecture. This option
 is off by default.
 
+--running-time::
+Record running and enabled time for read events (:S)
+
 SEE ALSO
 --------
 linkperf:perf-stat[1], linkperf:perf-list[1]
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index d0d02a8..4fdad06 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -839,6 +839,8 @@ struct option __record_options[] = {
 		    "use per-thread mmaps"),
 	OPT_BOOLEAN('I', "intr-regs", &record.opts.sample_intr_regs,
 		    "Sample machine registers on interrupt"),
+	OPT_BOOLEAN(0, "running-time", &record.opts.running_time,
+		    "Record running/enabled time of read (:S) events"),
 	OPT_END()
 };
 
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 1dabb85..1caa70a 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -53,6 +53,7 @@ struct record_opts {
 	bool	     sample_time;
 	bool	     period;
 	bool	     sample_intr_regs;
+	bool	     running_time;
 	unsigned int freq;
 	unsigned int mmap_pages;
 	unsigned int user_freq;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index f93e520..bb4eff2 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -734,6 +734,12 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)
 	if (opts->sample_transaction)
 		perf_evsel__set_sample_bit(evsel, TRANSACTION);
 
+	if (opts->running_time) {
+		evsel->attr.read_format |=
+			PERF_FORMAT_TOTAL_TIME_ENABLED |
+			PERF_FORMAT_TOTAL_TIME_RUNNING;
+	}
+
 	/*
 	 * XXX see the function comment above
 	 *

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-02-26 11:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-24 23:13 [PATCH] perf, tools, record: Support recording running/enabled time Andi Kleen
2015-02-25 15:13 ` Jiri Olsa
2015-02-25 15:42   ` Arnaldo Carvalho de Melo
2015-02-25 16:47 ` David Ahern
2015-02-26 11:35 ` [tip:perf/core] perf record: Support recording running/ enabled time tip-bot for Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox