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

perf record: Add --dry-run option to check cmdline options

With '--dry-run', 'perf record' doesn't do reall recording. Combine with
llvm.dump-obj option, --dry-run can be used to help compile BPF objects
for embedded platform.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1466064161-48553-3-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Wang Nan and committed by
Arnaldo Carvalho de Melo
0aab2136 f0784649

+14
+7
tools/perf/Documentation/perf-record.txt
··· 360 360 361 361 Implies --timestamp-filename, --no-buildid and --no-buildid-cache. 362 362 363 + --dry-run:: 364 + Parse options then exit. --dry-run can be used to detect errors in cmdline 365 + options. 366 + 367 + 'perf record --dry-run -e' can act as a BPF script compiler if llvm.dump-obj 368 + in config file is set to true. 369 + 363 370 SEE ALSO 364 371 -------- 365 372 linkperf:perf-stat[1], linkperf:perf-list[1]
+7
tools/perf/builtin-record.c
··· 1274 1274 const char record_callchain_help[] = CALLCHAIN_RECORD_HELP 1275 1275 "\n\t\t\t\tDefault: fp"; 1276 1276 1277 + static bool dry_run; 1278 + 1277 1279 /* 1278 1280 * XXX Will stay a global variable till we fix builtin-script.c to stop messing 1279 1281 * with it and switch to use the library functions in perf_evlist that came ··· 1395 1393 "append timestamp to output filename"), 1396 1394 OPT_BOOLEAN(0, "switch-output", &record.switch_output, 1397 1395 "Switch output when receive SIGUSR2"), 1396 + OPT_BOOLEAN(0, "dry-run", &dry_run, 1397 + "Parse options then exit"), 1398 1398 OPT_END() 1399 1399 }; 1400 1400 ··· 1465 1461 rec->opts.auxtrace_snapshot_opts); 1466 1462 if (err) 1467 1463 return err; 1464 + 1465 + if (dry_run) 1466 + return 0; 1468 1467 1469 1468 err = bpf__setup_stdout(rec->evlist); 1470 1469 if (err) {