aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/perf/builtin-record.c
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2016-06-16 08:02:41 +0000
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-06-21 13:18:35 -0300
commit0aab21363ffa66d6e7340bc50cc5bfae865fd1a6 (patch)
tree5e716031fc08a0d62d7213c63d149e6140069555 /tools/perf/builtin-record.c
parentperf llvm: Allow dump llvm output object file using llvm.dump-obj (diff)
downloadwireguard-linux-0aab21363ffa66d6e7340bc50cc5bfae865fd1a6.tar.xz
wireguard-linux-0aab21363ffa66d6e7340bc50cc5bfae865fd1a6.zip
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>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r--tools/perf/builtin-record.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index d4cf1b0c88f9..b1304ebc8779 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1274,6 +1274,8 @@ static struct record record = {
const char record_callchain_help[] = CALLCHAIN_RECORD_HELP
"\n\t\t\t\tDefault: fp";
+static bool dry_run;
+
/*
* XXX Will stay a global variable till we fix builtin-script.c to stop messing
* with it and switch to use the library functions in perf_evlist that came
@@ -1393,6 +1395,8 @@ struct option __record_options[] = {
"append timestamp to output filename"),
OPT_BOOLEAN(0, "switch-output", &record.switch_output,
"Switch output when receive SIGUSR2"),
+ OPT_BOOLEAN(0, "dry-run", &dry_run,
+ "Parse options then exit"),
OPT_END()
};
@@ -1462,6 +1466,9 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
if (err)
return err;
+ if (dry_run)
+ return 0;
+
err = bpf__setup_stdout(rec->evlist);
if (err) {
bpf__strerror_setup_stdout(rec->evlist, err, errbuf, sizeof(errbuf));