Skip to content

Commit b6f35ed

Browse files
olsajiriacmel
authored andcommitted
perf record: Add --sample-cpu option
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>
1 parent 52c5cc3 commit b6f35ed

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

tools/perf/Documentation/perf-record.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ OPTIONS
192192
--period::
193193
Record the sample period.
194194

195+
--sample-cpu::
196+
Record the sample cpu.
197+
195198
-n::
196199
--no-samples::
197200
Don't sample.

tools/perf/builtin-record.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,6 +1434,7 @@ struct option __record_options[] = {
14341434
OPT_BOOLEAN('s', "stat", &record.opts.inherit_stat,
14351435
"per thread counts"),
14361436
OPT_BOOLEAN('d', "data", &record.opts.sample_address, "Record the sample addresses"),
1437+
OPT_BOOLEAN(0, "sample-cpu", &record.opts.sample_cpu, "Record the sample cpu"),
14371438
OPT_BOOLEAN_SET('T', "timestamp", &record.opts.sample_time,
14381439
&record.opts.sample_time_set,
14391440
"Record the sample timestamps"),

tools/perf/perf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ struct record_opts {
5252
bool sample_weight;
5353
bool sample_time;
5454
bool sample_time_set;
55+
bool sample_cpu;
5556
bool period;
5657
bool running_time;
5758
bool full_auxtrace;

tools/perf/util/evsel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
882882
perf_evsel__set_sample_bit(evsel, REGS_INTR);
883883
}
884884

885-
if (target__has_cpu(&opts->target))
885+
if (target__has_cpu(&opts->target) || opts->sample_cpu)
886886
perf_evsel__set_sample_bit(evsel, CPU);
887887

888888
if (opts->period)

0 commit comments

Comments
 (0)