summaryrefslogtreecommitdiff
path: root/libs/battery/LongArrayMultiStateCounterTest.cpp
diff options
context:
space:
mode:
author Alec Mouri <alecmouri@google.com> 2022-05-11 01:22:42 +0000
committer Alec Mouri <alecmouri@google.com> 2022-05-18 22:24:10 +0000
commitaadcf949e345fd1fc818e37265bda0c29fcf5d8b (patch)
tree638d44f3c306beaa282acd94e1d1aa0d2eda5e6d /libs/battery/LongArrayMultiStateCounterTest.cpp
parent8ffb0288806aa7f41ff1b6f6ad9321980f955907 (diff)
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
Diffstat (limited to 'libs/battery/LongArrayMultiStateCounterTest.cpp')
0 files changed, 0 insertions, 0 deletions