aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2015-02-24 18:13:40 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-02-25 10:42:23 -0500
commit85c273d2b6569706762cf400079ca0699e007d81 (patch)
treeff85ad53d0f7ea05d8bea1aa685d7df33ad1f6ac /tools
parent506740654db4fa5b6e1229147cee3cf8c7e07eca (diff)
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Documentation/perf-record.txt3
-rw-r--r--tools/perf/builtin-record.c2
-rw-r--r--tools/perf/perf.h1
-rw-r--r--tools/perf/util/evsel.c6
4 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index 1c7e50f62b1f..cae75c11120f 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
241each sample. List of captured registers depends on the architecture. This option 241each sample. List of captured registers depends on the architecture. This option
242is off by default. 242is off by default.
243 243
244--running-time::
245Record running and enabled time for read events (:S)
246
244SEE ALSO 247SEE ALSO
245-------- 248--------
246linkperf:perf-stat[1], linkperf:perf-list[1] 249linkperf:perf-stat[1], linkperf:perf-list[1]
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index d0d02a811ecd..4fdad06d37db 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -839,6 +839,8 @@ struct option __record_options[] = {
839 "use per-thread mmaps"), 839 "use per-thread mmaps"),
840 OPT_BOOLEAN('I', "intr-regs", &record.opts.sample_intr_regs, 840 OPT_BOOLEAN('I', "intr-regs", &record.opts.sample_intr_regs,
841 "Sample machine registers on interrupt"), 841 "Sample machine registers on interrupt"),
842 OPT_BOOLEAN(0, "running-time", &record.opts.running_time,
843 "Record running/enabled time of read (:S) events"),
842 OPT_END() 844 OPT_END()
843}; 845};
844 846
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 1dabb8553499..1caa70a4a9e1 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -53,6 +53,7 @@ struct record_opts {
53 bool sample_time; 53 bool sample_time;
54 bool period; 54 bool period;
55 bool sample_intr_regs; 55 bool sample_intr_regs;
56 bool running_time;
56 unsigned int freq; 57 unsigned int freq;
57 unsigned int mmap_pages; 58 unsigned int mmap_pages;
58 unsigned int user_freq; 59 unsigned int user_freq;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index f93e5208c762..bb4eff28869e 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)
734 if (opts->sample_transaction) 734 if (opts->sample_transaction)
735 perf_evsel__set_sample_bit(evsel, TRANSACTION); 735 perf_evsel__set_sample_bit(evsel, TRANSACTION);
736 736
737 if (opts->running_time) {
738 evsel->attr.read_format |=
739 PERF_FORMAT_TOTAL_TIME_ENABLED |
740 PERF_FORMAT_TOTAL_TIME_RUNNING;
741 }
742
737 /* 743 /*
738 * XXX see the function comment above 744 * XXX see the function comment above
739 * 745 *