diff options
author | Wei Wang <wvw@google.com> | 2022-05-20 16:09:19 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-05-20 16:09:19 +0000 |
commit | 6d9335210fe4fc502c9d076f288727cf61ce4610 (patch) | |
tree | ab86bbee873bb71b949504976b8f854967d551bb | |
parent | c6afd5eaf67b7d152f5a635a331f06b9925a3d80 (diff) | |
parent | ecbc89a823a9172127182620efc61ff26d44ab82 (diff) | |
download | pixel-6d9335210fe4fc502c9d076f288727cf61ce4610.tar.gz |
Merge "Fix cancelling hints when refreshing expiring hints." into tm-dev am: ecbc89a823
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/google/pixel/+/18404464
Change-Id: Iaa0c797da6c085afe74802396ac928c929c42217
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | power-libperfmgr/adaptivecpu/AdaptiveCpu.cpp | 33 |
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, |