ANDROID: timer: Add vendor hook for timer calc index

Since we're expecting timers more precisely in short period, add
a vendor hook to calc_index when adding timers. Then we can modify
the index this timer used to make it accurate.

Bug: 178758017
Signed-off-by: Huang Yiwei <hyiwei@codeaurora.org>
Change-Id: Ie0e6493ae7ad53b0cc57eb1bbcf8a0a11f652828
This commit is contained in:
Huang Yiwei
2021-01-29 10:59:25 +08:00
committed by Todd Kjos
parent d4ff3d23ce
commit 9789a88f42
3 changed files with 24 additions and 0 deletions

View File

@@ -55,6 +55,8 @@
#define CREATE_TRACE_POINTS
#include <trace/events/timer.h>
#undef CREATE_TRACE_POINTS
#include <trace/hooks/timer.h>
EXPORT_TRACEPOINT_SYMBOL_GPL(hrtimer_expire_entry);
EXPORT_TRACEPOINT_SYMBOL_GPL(hrtimer_expire_exit);
@@ -505,6 +507,7 @@ static inline unsigned calc_index(unsigned long expires, unsigned lvl,
* Round up with level granularity to prevent this.
*/
expires = (expires + LVL_GRAN(lvl)) >> LVL_SHIFT(lvl);
trace_android_vh_timer_calc_index(lvl, &expires);
*bucket_expiry = expires << LVL_SHIFT(lvl);
return LVL_OFFS(lvl) + (expires & LVL_MASK);
}