diff options
author | 2020-07-16 17:37:39 +0800 | |
---|---|---|
committer | 2020-10-19 04:08:01 +0000 | |
commit | 1c855127ea2e2da223253b0dadcadde9a3ee94d0 (patch) | |
tree | 366b8fc392bb51b0929dd9709ba8b159a3437501 /cmds/dumpstate/DumpstateUtil.cpp | |
parent | 27077b1393e20c0e90fb7beeea7e3bba6014638e (diff) |
Faster bugreports (2/n)
- Having a system property to disable parallel run function.
- Post 'DumpTraces' to the thread pool. 3% is
improved compared with single thread run.
Bug: 136262402
Test: atest dumpstate_test
Test: atest dumpstate_smoke_test
Test: Manual enable and disable parallel run
Test: Manual trigger report using hardware key
Test: Manual trigger using bugreport shortcut
Change-Id: I2185cc3e2f429a150605d6268324c52d137db385
Merged-In: I2185cc3e2f429a150605d6268324c52d137db385
(cherry picked from commit 5377d797fff94e0e070fdbbadc89288d90cc5f2c)
Diffstat (limited to 'cmds/dumpstate/DumpstateUtil.cpp')
-rw-r--r-- | cmds/dumpstate/DumpstateUtil.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/cmds/dumpstate/DumpstateUtil.cpp b/cmds/dumpstate/DumpstateUtil.cpp index 4b69607156..eeaa5a3de0 100644 --- a/cmds/dumpstate/DumpstateUtil.cpp +++ b/cmds/dumpstate/DumpstateUtil.cpp @@ -180,6 +180,7 @@ CommandOptions::CommandOptionsBuilder CommandOptions::WithTimeoutInMs(int64_t ti std::string PropertiesHelper::build_type_ = ""; int PropertiesHelper::dry_run_ = -1; int PropertiesHelper::unroot_ = -1; +int PropertiesHelper::parallel_run_ = -1; bool PropertiesHelper::IsUserBuild() { if (build_type_.empty()) { @@ -202,6 +203,14 @@ bool PropertiesHelper::IsUnroot() { return unroot_ == 1; } +bool PropertiesHelper::IsParallelRun() { + if (parallel_run_ == -1) { + parallel_run_ = android::base::GetBoolProperty("dumpstate.parallel_run", + /* default_value = */true) ? 1 : 0; + } + return parallel_run_ == 1; +} + int DumpFileToFd(int out_fd, const std::string& title, const std::string& path) { android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(path.c_str(), O_RDONLY | O_NONBLOCK | O_CLOEXEC))); if (fd.get() < 0) { |