summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-20 19:47:45 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-20 19:47:45 +0000
commit6a32cdc58aa2874ed08e5732efd89d18c97c0497 (patch)
treeab86bbee873bb71b949504976b8f854967d551bb
parent2fe52a1fc8972f4bc3636a770c305a9d127006ba (diff)
parent6d9335210fe4fc502c9d076f288727cf61ce4610 (diff)
downloadpixel-6a32cdc58aa2874ed08e5732efd89d18c97c0497.tar.gz
Snap for 8622994 from 6d9335210fe4fc502c9d076f288727cf61ce4610 to mainline-extservices-release
Change-Id: I65c9502f67380bde0c5d57ba42309b07490664de
-rw-r--r--power-libperfmgr/adaptivecpu/AdaptiveCpu.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/power-libperfmgr/adaptivecpu/AdaptiveCpu.cpp b/power-libperfmgr/adaptivecpu/AdaptiveCpu.cpp
index 16b40284..0ad96399 100644
--- a/power-libperfmgr/adaptivecpu/AdaptiveCpu.cpp
+++ b/power-libperfmgr/adaptivecpu/AdaptiveCpu.cpp
@@ -177,22 +177,29 @@ void AdaptiveCpu::RunMainLoop() {
LOG(VERBOSE) << "Model decision: " << static_cast<uint32_t>(throttleDecision);
ATRACE_INT("AdaptiveCpu_throttleDecision", static_cast<uint32_t>(throttleDecision));
- const auto now = mTimeSource.GetTime();
- // Resend the throttle hints, even if they've not changed, if the previous send is close to
- // timing out. We define "close to" as half the hint timeout, as we can't guarantee we will
- // run again before the actual timeout.
- const bool throttleHintMayTimeout = now - mLastThrottleHintTime > mConfig.hintTimeout / 2;
- if (throttleDecision != previousThrottleDecision || throttleHintMayTimeout) {
- mLastThrottleHintTime = now;
+ {
ATRACE_NAME("sendHints");
- for (const auto &hintName : THROTTLE_DECISION_TO_HINT_NAMES.at(throttleDecision)) {
- HintManager::GetInstance()->DoHint(hintName, mConfig.hintTimeout);
+ const auto now = mTimeSource.GetTime();
+ // Resend the throttle hints, even if they've not changed, if the previous send is close
+ // to timing out. We define "close to" as half the hint timeout, as we can't guarantee
+ // we will run again before the actual timeout.
+ const bool throttleHintMayTimeout =
+ now - mLastThrottleHintTime > mConfig.hintTimeout / 2;
+ if (throttleDecision != previousThrottleDecision || throttleHintMayTimeout) {
+ ATRACE_NAME("sendNewHints");
+ mLastThrottleHintTime = now;
+ for (const auto &hintName : THROTTLE_DECISION_TO_HINT_NAMES.at(throttleDecision)) {
+ HintManager::GetInstance()->DoHint(hintName, mConfig.hintTimeout);
+ }
}
- for (const auto &hintName :
- THROTTLE_DECISION_TO_HINT_NAMES.at(previousThrottleDecision)) {
- HintManager::GetInstance()->EndHint(hintName);
+ if (throttleDecision != previousThrottleDecision) {
+ ATRACE_NAME("endOldHints");
+ for (const auto &hintName :
+ THROTTLE_DECISION_TO_HINT_NAMES.at(previousThrottleDecision)) {
+ HintManager::GetInstance()->EndHint(hintName);
+ }
+ previousThrottleDecision = throttleDecision;
}
- previousThrottleDecision = throttleDecision;
}
mAdaptiveCpuStats.RegisterSuccessfulRun(previousThrottleDecision, throttleDecision,