Timing Log
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