Looper Profiler
Constructors
LooperProfiler
Link copied to clipboard
fun LooperProfiler(threshold: Long = 200L, timeUnit: TimeUnit = MILLISECONDS, callback: (Int, Long, String) -> Unit = { what, duration, message ->
val log: (String, String) -> Int = if (duration >= NANOSECONDS.convert(threshold, timeUnit)) Log::w else Log::i
log(TAG, "[${"%8d".format(timeUnit.convert(duration, NANOSECONDS))}${TIME_UNIT_SYMBOLS[timeUnit.ordinal]}] ${"%4d".format(what)} : ${findCallback(message) ?: findHandler(message) ?: message}")
})
Content copied to clipboard