Merge "Prevent LOAD_RESET signal after too many false positives" into udc-dev
This commit is contained in:
@@ -156,6 +156,7 @@ void HintSessionWrapper::updateTargetWorkDuration(long targetWorkDurationNanos)
|
|||||||
|
|
||||||
void HintSessionWrapper::reportActualWorkDuration(long actualDurationNanos) {
|
void HintSessionWrapper::reportActualWorkDuration(long actualDurationNanos) {
|
||||||
if (!init()) return;
|
if (!init()) return;
|
||||||
|
mResetsSinceLastReport = 0;
|
||||||
if (actualDurationNanos > kSanityCheckLowerBound &&
|
if (actualDurationNanos > kSanityCheckLowerBound &&
|
||||||
actualDurationNanos < kSanityCheckUpperBound) {
|
actualDurationNanos < kSanityCheckUpperBound) {
|
||||||
gAPH_reportActualWorkDurationFn(mHintSession, actualDurationNanos);
|
gAPH_reportActualWorkDurationFn(mHintSession, actualDurationNanos);
|
||||||
@@ -163,9 +164,12 @@ void HintSessionWrapper::reportActualWorkDuration(long actualDurationNanos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HintSessionWrapper::sendLoadResetHint() {
|
void HintSessionWrapper::sendLoadResetHint() {
|
||||||
|
static constexpr int kMaxResetsSinceLastReport = 2;
|
||||||
if (!init()) return;
|
if (!init()) return;
|
||||||
nsecs_t now = systemTime();
|
nsecs_t now = systemTime();
|
||||||
if (now - mLastFrameNotification > kResetHintTimeout) {
|
if (now - mLastFrameNotification > kResetHintTimeout &&
|
||||||
|
mResetsSinceLastReport <= kMaxResetsSinceLastReport) {
|
||||||
|
++mResetsSinceLastReport;
|
||||||
gAPH_sendHintFn(mHintSession, static_cast<int>(SessionHint::CPU_LOAD_RESET));
|
gAPH_sendHintFn(mHintSession, static_cast<int>(SessionHint::CPU_LOAD_RESET));
|
||||||
}
|
}
|
||||||
mLastFrameNotification = now;
|
mLastFrameNotification = now;
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ private:
|
|||||||
APerformanceHintSession* mHintSession = nullptr;
|
APerformanceHintSession* mHintSession = nullptr;
|
||||||
std::future<APerformanceHintSession*> mHintSessionFuture;
|
std::future<APerformanceHintSession*> mHintSessionFuture;
|
||||||
|
|
||||||
|
int mResetsSinceLastReport = 0;
|
||||||
nsecs_t mLastFrameNotification = 0;
|
nsecs_t mLastFrameNotification = 0;
|
||||||
nsecs_t mLastTargetWorkDuration = 0;
|
nsecs_t mLastTargetWorkDuration = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user