TimingLog

class TimingLog(label: String, tag: String? = null)

Add logs containing how long it took to do each section. The logs will be added at the debug log level so the debug log level must be enabled. Verbose level logging creates a new section which is also totaled by the next debug level logs. If only logging debug level then the verbose level logs are not sent to the logs. Usage: val log = TimingLog("work") ... do work A (taking 5 ms) log.debug { "A" } ... do work B 1 (taking 1 ms) log.verbose { "B 1" } ... do work B 2 (taking 3 ms) log.verbose { "B 2" } log.debug { "B" } log.finish()

If the log level is set to debug or higher then this would output: D/Tag: work: begin TimingLog D/Tag: work: 5 ms A D/Tag: work: 4 ms B D/Tag: work: end 9 ms If the log level is set to verbose then this would output: D/Tag: work: begin TimingLog D/Tag: work: 5 ms A V/Tag: work: 1 ms B 1 V/Tag: work: 3 ms B 2 D/Tag: work: 4 ms B D/Tag: work: end 9 ms

Constructors

Link copied to clipboard
constructor(label: String, tag: String? = null)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Timing(val time: Long, val msg: String, val isVerbose: Boolean)

Functions

Link copied to clipboard
fun add(msg: String, isVerbose: Boolean)
Link copied to clipboard
inline fun debug(msg: () -> Any?)
Link copied to clipboard
fun finish(minThresholdMs: Long = 0)

Report timing logs. If minThresholdMs is greater than 0 then only report if total time exceeds this amount

Link copied to clipboard
fun reset()
Link copied to clipboard
inline fun verbose(msg: () -> Any?)