diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-02-07 01:24:16 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-02-07 01:24:16 +0000 |
commit | d01f9dd6493945483a19e479d9a13dd79d64d46e (patch) | |
tree | d59f27eddec4be3a5aed8ef0e4e714aa73174d1f | |
parent | 329daa8b39041fb2041a52aa35dd945b39e870f2 (diff) | |
parent | a28d76c850064639146c8c335f5f0e89a8a05819 (diff) | |
download | extras-d01f9dd6493945483a19e479d9a13dd79d64d46e.tar.gz |
Merge "Simpleperf: Support record --"
-rw-r--r-- | simpleperf/cmd_record.cpp | 5 | ||||
-rw-r--r-- | simpleperf/cmd_record_test.cpp | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/simpleperf/cmd_record.cpp b/simpleperf/cmd_record.cpp index 4056474b..880badf3 100644 --- a/simpleperf/cmd_record.cpp +++ b/simpleperf/cmd_record.cpp @@ -91,7 +91,7 @@ class RecordCommand : public Command { : Command( "record", "record sampling info in perf.data", // clang-format off -"Usage: simpleperf record [options] [command [command-args]]\n" +"Usage: simpleperf record [options] [--] [command [command-args]]\n" " Gather sampling information of running [command]. And -a/-p/-t option\n" " can be used to change target of sampling information.\n" " The default options are: -e cpu-cycles -f 4000 -o perf.data.\n" @@ -745,6 +745,9 @@ bool RecordCommand::ParseOptions(const std::vector<std::string>& args, if (!SetTracepointEventsFilePath(args[i])) { return false; } + } else if (args[i] == "--") { + i++; + break; } else { ReportUnknownOption(args, i); return false; diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp index 78690371..7f208862 100644 --- a/simpleperf/cmd_record_test.cpp +++ b/simpleperf/cmd_record_test.cpp @@ -564,3 +564,8 @@ TEST(record_cmd, callchain_joiner_options) { ASSERT_TRUE(RunRecordCmd({"--no-callchain-joiner"})); ASSERT_TRUE(RunRecordCmd({"--callchain-joiner-min-matching-nodes", "2"})); } + +TEST(record_cmd, dashdash) { + TemporaryFile tmpfile; + ASSERT_TRUE(RecordCmd()->Run({"-o", tmpfile.path, "--", "sleep", "1"})); +} |