Skip to content

Instantly share code, notes, and snippets.

@apk
Created October 25, 2011 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apk/1313587 to your computer and use it in GitHub Desktop.
Save apk/1313587 to your computer and use it in GitHub Desktop.
time trace wrapper
def took(msg: String)(expr: => Unit) = {
val s = System.currentTimeMillis();
expr
val d = System.currentTimeMillis() - s;
val m = msg + " took " + d + "ms";
println m;
tooks += m; // Collect traces, too
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment