All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hammerlab.timing.Timer.scala Maven / Gradle / Ivy

There is a newer version: 5.2.1
Show newest version
package org.hammerlab.timing

import java.lang.System.currentTimeMillis

trait Timer {
  def time[T](fn: ⇒ T): (Long, T) = time("")(fn)

  def time[T](msg: ⇒ String)(fn: ⇒ T): (Long, T) = {
    val before = currentTimeMillis
    val res = fn
    val after = currentTimeMillis
    (after - before, res)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy