diff options
author | Yabin Cui <yabinc@google.com> | 2018-04-18 13:10:40 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2018-04-20 18:18:45 -0700 |
commit | acf04b213d334df8880aa324711a03a8a91ffa07 (patch) | |
tree | eaf0ca754d9e7b9f0c7d2bf13600faba72e2a3fc /simpleperf/cmd_stat.cpp | |
parent | ddb48c1cac7442b8aa7b7b2487c074da449eb3a0 (diff) | |
download | extras-acf04b213d334df8880aa324711a03a8a91ffa07.tar.gz |
simpleperf: add --size-limit option in record cmd.
--size-limit option stops recording when the recorded data
reaches the size limit. It is used by
run_simpleperf_without_usb_connection.py to avoid taking too much disk
space.
Bug: http://b/74198167
Test: run simpleperf_unit_test.
Test: run test.py.
Change-Id: I11f0023c342c50e1cf8035430e6af1b3caa329e7
Diffstat (limited to 'simpleperf/cmd_stat.cpp')
-rw-r--r-- | simpleperf/cmd_stat.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/simpleperf/cmd_stat.cpp b/simpleperf/cmd_stat.cpp index 21c74ea6..da5b603b 100644 --- a/simpleperf/cmd_stat.cpp +++ b/simpleperf/cmd_stat.cpp @@ -28,7 +28,6 @@ #include <android-base/file.h> #include <android-base/logging.h> -#include <android-base/parsedouble.h> #include <android-base/strings.h> #include "command.h" @@ -531,21 +530,11 @@ bool StatCommand::ParseOptions(const std::vector<std::string>& args, } else if (args[i] == "--csv") { csv_ = true; } else if (args[i] == "--duration") { - if (!NextArgumentOrError(args, &i)) { - return false; - } - if (!android::base::ParseDouble(args[i].c_str(), &duration_in_sec_, - 1e-9)) { - LOG(ERROR) << "Invalid duration: " << args[i].c_str(); + if (!GetDoubleOption(args, &i, &duration_in_sec_, 1e-9)) { return false; } } else if (args[i] == "--interval") { - if (!NextArgumentOrError(args, &i)) { - return false; - } - if (!android::base::ParseDouble(args[i].c_str(), &interval_in_ms_, - 1e-9)) { - LOG(ERROR) << "Invalid interval: " << args[i].c_str(); + if (!GetDoubleOption(args, &i, &interval_in_ms_, 1e-9)) { return false; } } else if (args[i] == "--interval-only-values") { |