App.kt
package bj
import org.springframework.util.StopWatch
import java.util.concurrent.TimeUnit
fun main(args: Array<String>) {
val stopWatch = StopWatch("Sleeping")
stopWatch.start("First sleeping")
TimeUnit.SECONDS.sleep(1)
stopWatch.stop()
stopWatch.start("Second sleeping")
TimeUnit.SECONDS.sleep(2)
stopWatch.stop()
println(stopWatch.prettyPrint())
}
StopWatch 'Sleeping': running time (millis) = 3006
-----------------------------------------
ms % Task name
-----------------------------------------
01002 033% First sleeping
02004 067% Second sleeping