aprsdroid/src/Benchmark.scala

18 wiersze
335 B
Scala

package org.aprsdroid.app
import _root_.android.util.Log
object Benchmark {
def apply[T](tag: String)(block: => T) : T = {
val start = System.currentTimeMillis
try {
block
} finally {
val exectime = System.currentTimeMillis - start
Log.d(tag, "exectuion time: %.3f s".formatLocal(null, exectime / 1000.0))
}
}
}