Reduce gratuitous resets for OneShotTimer
OneShotTimer::reset just resets an internal timer thread for it to go back to sleep. When just implemented with semaphores, this introduces a lot of syscall churn due to posting a semaphore -> waking up the timer thread -> having the thread go back to sleep. Instead, we can avoid resetting the timer if we know that the thread is about to wait for a short amount of time, and only reset the timer if the thread is in an idle state. This patch reduces instruction counts by 5%, and CPU cycles incurred by an additional 5%. Bug: 232272570 Test: bouncy ball Change-Id: I83f968042395857237875aab8dca0e6b90d392cb
Loading
Please register or sign in to comment