From: Wang Nan <wangnan0@huawei.com>
To: <acme@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <pi3orama@163.com>,
Wang Nan <wangnan0@huawei.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
"Alexei Starovoitov" <ast@kernel.org>,
Jiri Olsa <jolsa@kernel.org>
Subject: [PATCH 2/2] perf record: Add --dry-run option to check cmdline options
Date: Thu, 16 Jun 2016 08:02:41 +0000 [thread overview]
Message-ID: <1466064161-48553-3-git-send-email-wangnan0@huawei.com> (raw)
In-Reply-To: <1466064161-48553-1-git-send-email-wangnan0@huawei.com>
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: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/Documentation/perf-record.txt | 7 +++++++
tools/perf/builtin-record.c | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index 8dbee83..5b46b1d 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -360,6 +360,13 @@ particular perf.data snapshot should be kept or not.
Implies --timestamp-filename, --no-buildid and --no-buildid-cache.
+--dry-run::
+Parse options then exit. --dry-run can be used to detect errors in cmdline
+options.
+
+'perf record --dry-run -e' can act as a BPF script compiler if llvm.dump-obj
+in config file is set to true.
+
SEE ALSO
--------
linkperf:perf-stat[1], linkperf:perf-list[1]
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index d4cf1b0..b1304eb 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));
--
1.8.3.4
next prev parent reply other threads:[~2016-06-16 8:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-16 8:02 [PATCH 0/2] perf bpf: Add helper to support generate BPF object Wang Nan
2016-06-16 8:02 ` [PATCH 1/2] perf llvm: Allow dump llvm output object file using llvm.dump-obj Wang Nan
2016-06-22 7:42 ` [tip:perf/core] " tip-bot for Wang Nan
2016-06-16 8:02 ` Wang Nan [this message]
2016-06-16 16:48 ` [PATCH 2/2] perf record: Add --dry-run option to check cmdline options Arnaldo Carvalho de Melo
2016-06-16 16:50 ` Arnaldo Carvalho de Melo
2016-06-20 3:29 ` Wangnan (F)
2016-06-20 14:38 ` Arnaldo Carvalho de Melo
2016-06-20 16:22 ` Alexei Starovoitov
2016-06-20 18:13 ` Arnaldo Carvalho de Melo
2016-06-20 18:16 ` David Ahern
2016-06-20 18:52 ` Arnaldo Carvalho de Melo
2016-06-21 2:02 ` Namhyung Kim
2016-06-21 2:49 ` David Ahern
2016-06-21 6:12 ` Wangnan (F)
2016-06-21 16:11 ` perf cc/perf bpf was: " Arnaldo Carvalho de Melo
2016-06-21 1:57 ` Wangnan (F)
2016-06-22 7:43 ` [tip:perf/core] " tip-bot for Wang Nan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1466064161-48553-3-git-send-email-wangnan0@huawei.com \
--to=wangnan0@huawei.com \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=ast@kernel.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pi3orama@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).