diff options
| author | 2022-04-20 13:47:22 +0000 | |
|---|---|---|
| committer | 2022-04-20 13:47:22 +0000 | |
| commit | 49c95b1618b8d89a5ff4da985209859812a5b3cc (patch) | |
| tree | b5529c79ef9204824cab4ae2c25484dfa140299e | |
| parent | 701b3f759c8efc7515b2b24386a44f81f1dfee97 (diff) | |
| parent | 9f174f4bbbf9a3ec26f8b4ab72d933b28601c8a1 (diff) | |
Merge "Send the hint immediately when actual > target" into tm-dev
| -rw-r--r-- | native/android/performance_hint.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/native/android/performance_hint.cpp b/native/android/performance_hint.cpp index 65428de95519..d627984c7fff 100644 --- a/native/android/performance_hint.cpp +++ b/native/android/performance_hint.cpp @@ -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); |