perf record: Support recording running/enabled time
authorAndi Kleen <ak@linux.intel.com>
Tue, 24 Feb 2015 23:13:40 +0000 (15:13 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 25 Feb 2015 15:42:23 +0000 (12:42 -0300)
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
tools/perf/builtin-record.c
tools/perf/perf.h
tools/perf/util/evsel.c

index 1c7e50f62b1fe221edd7d97966c52633a375eb71..cae75c11120f1d8dcfbe1a82551381903fb09601 100644 (file)
@@ -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]
index d0d02a811ecd69aa3c6cc58fdb4fb51315bafe9b..4fdad06d37dbc7e8f7f9fd5d8d4ba7f92b28d25d 100644 (file)
@@ -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()
 };
 
index 1dabb855349978de385f45690499d83f86e10580..1caa70a4a9e1bb96b759f02de14ab3aabe257b33 100644 (file)
@@ -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;
index f93e5208c76260c8dc40aafd7b9c241dc62a79d2..bb4eff28869eb3513a8558159cc9a73c408ea445 100644 (file)
@@ -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
         *