Merge "Send the hint immediately when actual > target" into tm-dev

This commit is contained in:
Jimmy Shiu
2022-04-20 13:47:22 +00:00
committed by Android (Google) Code Review

View File

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