perf record: Add --sample-cpu option
authorJiri Olsa <jolsa@kernel.org>
Mon, 1 Aug 2016 18:02:35 +0000 (20:02 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 2 Aug 2016 19:33:29 +0000 (16:33 -0300)
Adding --sample-cpu option to be able to explicitly enable CPU sample
type. Currently it's only enable implicitly in case the target is cpu
related.

It will be useful for following c2c record tool.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1470074555-24889-8-git-send-email-jolsa@kernel.org
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 69966abf65d1b21dd6741be6fd7eeb3e9e9d1bfc..379a2bed07c09da5698f0555f567512c33453146 100644 (file)
@@ -192,6 +192,9 @@ OPTIONS
 --period::
        Record the sample period.
 
+--sample-cpu::
+       Record the sample cpu.
+
 -n::
 --no-samples::
        Don't sample.
index 8f2c16d9275f303aca4c8ba3d7f148fb71a4df00..6355902fbfc8a28137335c49450ca4cf27a21ddb 100644 (file)
@@ -1434,6 +1434,7 @@ 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(0, "sample-cpu", &record.opts.sample_cpu, "Record the sample cpu"),
        OPT_BOOLEAN_SET('T', "timestamp", &record.opts.sample_time,
                        &record.opts.sample_time_set,
                        "Record the sample timestamps"),
index a7e0f14972444771aad97208978aac529c03566e..cb0f1356ff8149b4d0790e3d181cd6802f6886f0 100644 (file)
@@ -52,6 +52,7 @@ struct record_opts {
        bool         sample_weight;
        bool         sample_time;
        bool         sample_time_set;
+       bool         sample_cpu;
        bool         period;
        bool         running_time;
        bool         full_auxtrace;
index 4c2b31dc4e4d67643b2cd7af4b628d5cb5cb43fb..d9b80ef881cde43a1e134b89c6a752f2ae06d108 100644 (file)
@@ -882,7 +882,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
                perf_evsel__set_sample_bit(evsel, REGS_INTR);
        }
 
-       if (target__has_cpu(&opts->target))
+       if (target__has_cpu(&opts->target) || opts->sample_cpu)
                perf_evsel__set_sample_bit(evsel, CPU);
 
        if (opts->period)