perf record: Honour --no-time command line option
authorAndi Kleen <ak@linux.intel.com>
Thu, 31 Jul 2014 06:45:04 +0000 (14:45 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 12 Aug 2014 15:00:03 +0000 (12:00 -0300)
Time stamps are always implicitely enabled for record currently.  The
old --time/-T option is a nop.

Allow the user to disable timestamps by using --no-time, honouring the
existing option.

The defaults are unchanged.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1406789104-25863-10-git-send-email-zheng.z.yan@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-record.c
tools/perf/util/evsel.c

index 4869050e7194c18311da81f165f6f8e5cb5882ea..ca0251e8470d0d12a01e32f6b3e6a1253c47393c 100644 (file)
@@ -781,6 +781,7 @@ static const char * const record_usage[] = {
  */
 static struct record record = {
        .opts = {
+               .sample_time         = true,
                .mmap_pages          = UINT_MAX,
                .user_freq           = UINT_MAX,
                .user_interval       = ULLONG_MAX,
index 21a373ebea226a8208c3ccf2aaee9ad92ad4156d..92e5235f537763e5fa215c6f8c7ace0dfffe47cd 100644 (file)
@@ -633,9 +633,12 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)
        if (opts->period)
                perf_evsel__set_sample_bit(evsel, PERIOD);
 
-       if (!perf_missing_features.sample_id_all &&
-           (opts->sample_time || !opts->no_inherit ||
-            target__has_cpu(&opts->target) || per_cpu))
+       /*
+        * When the user explicitely disabled time don't force it here.
+        */
+       if (opts->sample_time &&
+           (!perf_missing_features.sample_id_all &&
+           (!opts->no_inherit || target__has_cpu(&opts->target) || per_cpu)))
                perf_evsel__set_sample_bit(evsel, TIME);
 
        if (opts->raw_samples && !evsel->no_aux_samples) {