Merge "Send the hint immediately when actual > target" into tm-dev am: 49c95b1618

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17011864

Change-Id: I3d9d31bf313c49fda8c341b52739796a097ae622
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jimmy Shiu
2022-04-20 14:25:31 +00:00
committed by Automerger Merge Worker

View File

@@ -184,13 +184,13 @@ int APerformanceHintSession::reportActualWorkDuration(int64_t actualDurationNano
mTimestampsNanos.push_back(now);
/**
* Use current sample to determine the rate limit. We can pick a shorter rate limit
* if any sample underperformed, however, it could be the lower level system is slow
* to react. So here we explicitly choose the rate limit with the latest sample.
* Cache the hint if the hint is not overtime and the mLastUpdateTimestamp is
* still in the mPreferredRateNanos duration.
*/
int64_t rateLimit = actualDurationNanos > mTargetDurationNanos ? mPreferredRateNanos
: 10 * mPreferredRateNanos;
if (now - mLastUpdateTimestamp <= rateLimit) return 0;
if (actualDurationNanos < mTargetDurationNanos &&
now - mLastUpdateTimestamp <= mPreferredRateNanos) {
return 0;
}
binder::Status ret =
mHintSession->reportActualWorkDuration(mActualDurationsNanos, mTimestampsNanos);