perf record: Let user have timestamps with per-thread recording
authorAdrian Hunter <adrian.hunter@intel.com>
Mon, 6 Jul 2015 11:51:01 +0000 (14:51 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 6 Jul 2015 11:58:36 +0000 (08:58 -0300)
If the option -T is used with option --per-thread, then time is still
not sampled.  Fix that by using OPT_BOOLEAN_SET to distinguish when the
user used the -T option as opposed to the default case when timestamps
are enabled but only for per-cpu recording.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1436183461-1918-1-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-record.c
tools/perf/perf.h
tools/perf/util/evsel.c

index de165a1b92402ac7a6267bd0a0c5aa30a0053c92..283fe96bdfc1593916401e69ca604d3049786017 100644 (file)
@@ -1030,7 +1030,9 @@ struct option __record_options[] = {
        OPT_BOOLEAN('s', "stat", &record.opts.inherit_stat,
                    "per thread counts"),
        OPT_BOOLEAN('d', "data", &record.opts.sample_address, "Record the sample addresses"),
-       OPT_BOOLEAN('T', "timestamp", &record.opts.sample_time, "Record the sample timestamps"),
+       OPT_BOOLEAN_SET('T', "timestamp", &record.opts.sample_time,
+                       &record.opts.sample_time_set,
+                       "Record the sample timestamps"),
        OPT_BOOLEAN('P', "period", &record.opts.period, "Record the sample period"),
        OPT_BOOLEAN('n', "no-samples", &record.opts.no_samples,
                    "don't sample"),
index 4a5827fff7993d2bbe87666af51aa939f6f9dd1d..937b16aa0300d92fddb065858d8b36274ec24b93 100644 (file)
@@ -51,6 +51,7 @@ struct record_opts {
        bool         sample_address;
        bool         sample_weight;
        bool         sample_time;
+       bool         sample_time_set;
        bool         period;
        bool         sample_intr_regs;
        bool         running_time;
index 6cc97f37887dff1499c5c4420f60cb95a5d481b4..83c08037e7e21aca831c7c6b7af2114adea88720 100644 (file)
@@ -707,7 +707,8 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)
         */
        if (opts->sample_time &&
            (!perf_missing_features.sample_id_all &&
-           (!opts->no_inherit || target__has_cpu(&opts->target) || per_cpu)))
+           (!opts->no_inherit || target__has_cpu(&opts->target) || per_cpu ||
+            opts->sample_time_set)))
                perf_evsel__set_sample_bit(evsel, TIME);
 
        if (opts->raw_samples && !evsel->no_aux_samples) {