summaryrefslogtreecommitdiff
path: root/aosp/update_attempter_android.cc
diff options
context:
space:
mode:
authorGabriele M <moto.falcon.git@gmail.com>2018-06-14 01:10:09 +0200
committeralk3pInjection <webmaster@raspii.tech>2022-02-05 20:27:30 +0800
commitec8d623b74826a51fa08599f62a354b473a7da24 (patch)
tree385bc9169f1d85abd0b87cc49296f32976f0e81b /aosp/update_attempter_android.cc
parent2787b94effe7d2fa1496823d982692b394772c19 (diff)
update_engine: Add performance modeHEADsugisawa-mr1sugisawa
Author: Gabriele M <moto.falcon.git@gmail.com> Date: Thu Jun 14 01:10:09 2018 +0200 update_engine: Add performance mode Allow to move update_engine from the system-background cgroup to the foreground cgroup to speed up the installation of the updates. Change-Id: Iaa531a925f9e1a26e834d7448c4755151adcfea2 Author: Luca Stefani <luca.stefani.ge1@gmail.com> Date: Mon Mar 4 14:57:28 2019 +0100 Move performance mode to top app Change-Id: I436102b4f8d046b8f3d897882613ec46acf9e2c5 luca020400: Move to TaskProfiles API Change-Id: Id7e27b0c42d80c4a3ce1dc7f8540313a7042db53
Diffstat (limited to 'aosp/update_attempter_android.cc')
-rw-r--r--aosp/update_attempter_android.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc
index 4636c430..bc03a1f2 100644
--- a/aosp/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -30,6 +30,7 @@
#include <brillo/message_loops/message_loop.h>
#include <brillo/strings/string_utils.h>
#include <log/log_safetynet.h>
+#include <processgroup/processgroup.h>
#include "update_engine/aosp/cleanup_previous_update_action.h"
#include "update_engine/common/constants.h"
@@ -144,6 +145,7 @@ UpdateAttempterAndroid::UpdateAttempterAndroid(
metrics_reporter_ = metrics::CreateMetricsReporter(
boot_control_->GetDynamicPartitionControl(), &install_plan_);
network_selector_ = network::CreateNetworkSelector();
+ SetTaskProfiles(0, {"ServiceCapacityLow", "LowIoPriority", "HighEnergySaving"});
}
UpdateAttempterAndroid::~UpdateAttempterAndroid() {
@@ -541,6 +543,23 @@ bool UpdateAttempterAndroid::VerifyPayloadApplicable(
return true;
}
+bool UpdateAttempterAndroid::SetPerformanceMode(bool enable,
+ brillo::ErrorPtr* error) {
+ LOG(INFO) << (enable ? "Enabling" : "Disabling") << " performance mode.";
+
+ if (performance_mode_ == enable)
+ return true;
+ bool ret;
+ if (enable)
+ ret = SetTaskProfiles(0, {"ProcessCapacityMax", "HighIoPriority", "MaxPerformance"});
+ else
+ ret = SetTaskProfiles(0, {"ServiceCapacityLow", "LowIoPriority", "HighEnergySaving"});
+ if (!ret)
+ return LogAndSetError(error, FROM_HERE, "Could not change profiles");
+ performance_mode_ = enable;
+ return true;
+}
+
void UpdateAttempterAndroid::ProcessingDone(const ActionProcessor* processor,
ErrorCode code) {
LOG(INFO) << "Processing Done.";