Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
b6f35ed7 52c5cc36

+6 -1
+3
tools/perf/Documentation/perf-record.txt
··· 192 192 --period:: 193 193 Record the sample period. 194 194 195 + --sample-cpu:: 196 + Record the sample cpu. 197 + 195 198 -n:: 196 199 --no-samples:: 197 200 Don't sample.
+1
tools/perf/builtin-record.c
··· 1434 1434 OPT_BOOLEAN('s', "stat", &record.opts.inherit_stat, 1435 1435 "per thread counts"), 1436 1436 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"), 1437 1438 OPT_BOOLEAN_SET('T', "timestamp", &record.opts.sample_time, 1438 1439 &record.opts.sample_time_set, 1439 1440 "Record the sample timestamps"),
+1
tools/perf/perf.h
··· 52 52 bool sample_weight; 53 53 bool sample_time; 54 54 bool sample_time_set; 55 + bool sample_cpu; 55 56 bool period; 56 57 bool running_time; 57 58 bool full_auxtrace;
+1 -1
tools/perf/util/evsel.c
··· 882 882 perf_evsel__set_sample_bit(evsel, REGS_INTR); 883 883 } 884 884 885 - if (target__has_cpu(&opts->target)) 885 + if (target__has_cpu(&opts->target) || opts->sample_cpu) 886 886 perf_evsel__set_sample_bit(evsel, CPU); 887 887 888 888 if (opts->period)