1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Millis and seconds.

This commit is contained in:
Cedric Beust 2015-12-23 20:24:23 +04:00
parent 941e254cca
commit f4e04e138c

View file

@ -1,8 +1,12 @@
package com.beust.kobalt.misc
public fun benchmark(run: () -> Unit) : Long {
fun benchmarkMillis(run: () -> Unit) : Long {
val start = System.currentTimeMillis()
run()
return (System.currentTimeMillis() - start) / 1000
return System.currentTimeMillis() - start
}
fun benchmarkSeconds(run: () -> Unit) = benchmarkMillis(run) / 1000