Remove --max-{execution, child-process}-seconds
Moving odrefresh into the VM has a nice side effect: Input files are now
cached by the VFS in the VM. Whereas in the previous setup, each dex2oat
has a completely new authfs instance, i.e. same input files need to be
copied for many times.
Currently, odrefresh takes about ~250 seconds to complete, which is
within the time limit. In fact, we've stopped giving the VM extra time
since the migration was done. This change removes the dead flag/code.
Bug: 211977683
Test: TH
Change-Id: Ia0114df6d768264d871bc067f591b12f1481d0f5
diff --git a/odrefresh/odr_config.h b/odrefresh/odr_config.h
index 7b89a83..b44e4e2 100644
--- a/odrefresh/odr_config.h
+++ b/odrefresh/odr_config.h
@@ -32,12 +32,6 @@
namespace art {
namespace odrefresh {
-// Maximum execution time for odrefresh from start to end.
-constexpr time_t kMaximumExecutionSeconds = 300;
-
-// Maximum execution time for any child process spawned.
-constexpr time_t kMaxChildProcessSeconds = 90;
-
// An enumeration of the possible zygote configurations on Android.
enum class ZygoteKind : uint8_t {
// 32-bit primary zygote, no secondary zygote.
@@ -68,8 +62,6 @@
ZygoteKind zygote_kind_;
std::string boot_classpath_;
std::string artifact_dir_;
- time_t max_execution_seconds_ = kMaximumExecutionSeconds;
- time_t max_child_process_seconds_ = kMaxChildProcessSeconds;
std::string standalone_system_server_jars_;
bool compilation_os_mode_ = false;
@@ -150,8 +142,6 @@
const std::string& GetStagingDir() const {
return staging_dir_;
}
- time_t GetMaxExecutionSeconds() const { return max_execution_seconds_; }
- time_t GetMaxChildProcessSeconds() const { return max_child_process_seconds_; }
bool GetCompilationOsMode() const { return compilation_os_mode_; }
void SetApexInfoListFile(const std::string& file_path) { apex_info_list_file_ = file_path; }
@@ -173,8 +163,6 @@
refresh_ = value;
}
void SetIsa(const InstructionSet isa) { isa_ = isa; }
- void SetMaxExecutionSeconds(int seconds) { max_execution_seconds_ = seconds; }
- void SetMaxChildProcessSeconds(int seconds) { max_child_process_seconds_ = seconds; }
void SetSystemServerClasspath(const std::string& classpath) {
system_server_classpath_ = classpath;
diff --git a/odrefresh/odrefresh.cc b/odrefresh/odrefresh.cc
index f573134..431dd5b 100644
--- a/odrefresh/odrefresh.cc
+++ b/odrefresh/odrefresh.cc
@@ -110,6 +110,12 @@
// Name of cache info file in the ART Apex artifact cache.
constexpr const char* kCacheInfoFile = "cache-info.xml";
+// Maximum execution time for odrefresh from start to end.
+constexpr time_t kMaximumExecutionSeconds = 300;
+
+// Maximum execution time for any child process spawned.
+constexpr time_t kMaxChildProcessSeconds = 90;
+
constexpr mode_t kFileMode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
constexpr const char* kFirstBootImageBasename = "boot.art";
@@ -581,11 +587,11 @@
time_t OnDeviceRefresh::GetExecutionTimeRemaining() const {
return std::max(static_cast<time_t>(0),
- config_.GetMaxExecutionSeconds() - GetExecutionTimeUsed());
+ kMaximumExecutionSeconds - GetExecutionTimeUsed());
}
time_t OnDeviceRefresh::GetSubprocessTimeout() const {
- return std::min(GetExecutionTimeRemaining(), config_.GetMaxChildProcessSeconds());
+ return std::min(GetExecutionTimeRemaining(), kMaxChildProcessSeconds);
}
std::optional<std::vector<apex::ApexInfo>> OnDeviceRefresh::GetApexInfoList() const {
diff --git a/odrefresh/odrefresh_main.cc b/odrefresh/odrefresh_main.cc
index f93ee93..efcae2c 100644
--- a/odrefresh/odrefresh_main.cc
+++ b/odrefresh/odrefresh_main.cc
@@ -19,7 +19,6 @@
#include <string>
#include <string_view>
-#include "android-base/parseint.h"
#include "android-base/properties.h"
#include "android-base/stringprintf.h"
#include "android-base/strings.h"
@@ -134,18 +133,6 @@
} else if (ArgumentMatches(arg, "--dalvik-cache=", &value)) {
art::OverrideDalvikCacheSubDirectory(value);
config->SetArtifactDirectory(GetApexDataDalvikCacheDirectory(art::InstructionSet::kNone));
- } else if (ArgumentMatches(arg, "--max-execution-seconds=", &value)) {
- int seconds;
- if (!android::base::ParseInt(value, &seconds)) {
- ArgumentError("Failed to parse integer: %s", value.c_str());
- }
- config->SetMaxExecutionSeconds(seconds);
- } else if (ArgumentMatches(arg, "--max-child-process-seconds=", &value)) {
- int seconds;
- if (!android::base::ParseInt(value, &seconds)) {
- ArgumentError("Failed to parse integer: %s", value.c_str());
- }
- config->SetMaxChildProcessSeconds(seconds);
} else if (ArgumentMatches(arg, "--zygote-arch=", &value)) {
zygote = value;
} else if (ArgumentMatches(arg, "--system-server-compiler-filter=", &value)) {
@@ -205,8 +192,6 @@
UsageMsg(" OS.");
UsageMsg("--dalvik-cache=<DIR> Write artifacts to .../<DIR> rather than");
UsageMsg(" .../dalvik-cache");
- UsageMsg("--max-execution-seconds=<N> Maximum timeout of all compilation combined");
- UsageMsg("--max-child-process-seconds=<N> Maximum timeout of each compilation task");
UsageMsg("--staging-dir=<DIR> Write temporary artifacts to <DIR> rather than");
UsageMsg(" .../staging");
UsageMsg("--zygote-arch=<STRING> Zygote kind that overrides ro.zygote");