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

perf record: Add -a as default target

Running 'perf record' with no target (-a, -p, -t, etc) will now collect
system wide data.

Commiter notes:

Testing it:

[root@jouet ~]# perf record
^C[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.351 MB perf.data (366 samples) ]
#

is equivalent to:

# perf record -a
^C[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.411 MB perf.data (978 samples) ]
#

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20170217170018.GA15389@krava
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
483635a9 0d79f8b9

+4 -2
+1 -1
tools/perf/Documentation/perf-record.txt
··· 157 157 158 158 -a:: 159 159 --all-cpus:: 160 - System-wide collection from all CPUs. 160 + System-wide collection from all CPUs (default if no target is specified). 161 161 162 162 -p:: 163 163 --pid=::
+3 -1
tools/perf/builtin-record.c
··· 1677 1677 1678 1678 argc = parse_options(argc, argv, record_options, record_usage, 1679 1679 PARSE_OPT_STOP_AT_NON_OPTION); 1680 + 1681 + /* Make system wide (-a) the default target. */ 1680 1682 if (!argc && target__none(&rec->opts.target)) 1681 - usage_with_options(record_usage, record_options); 1683 + rec->opts.target.system_wide = true; 1682 1684 1683 1685 if (nr_cgroups && !rec->opts.target.system_wide) { 1684 1686 usage_with_options_msg(record_usage, record_options,