Created
July 4, 2020 04:25
-
-
Save yangweigbh/8f97d61d4bd40d8796d61c389c5806a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun bumpCurrentThreadPriority() = synchronized(lock) { | |
val myTid = Process.myTid() | |
if (initialTid == myTid) { | |
// already bumped | |
return | |
} | |
// ensure we don't have multiple threads bumped at once | |
resetBumpedThread() | |
initialTid = myTid | |
initialPriority = Process.getThreadPriority(initialTid) | |
setThreadPriority("Bench thread", initialTid, BENCH_THREAD_PRIORITY) | |
if (JIT_TID != null) { | |
setThreadPriority("Jit", JIT_TID, JIT_THREAD_PRIORITY) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment