Skip to content

Instantly share code, notes, and snippets.

@c0rp-aubakirov
Created February 9, 2016 11:22
Show Gist options
  • Save c0rp-aubakirov/072cb5d12b508bf030dc to your computer and use it in GitHub Desktop.
Save c0rp-aubakirov/072cb5d12b508bf030dc to your computer and use it in GitHub Desktop.
Timer
public static <R> R executeFunctionWithTimer(Callable<R> f) throws Exception {
final Stopwatch timer = Stopwatch.createUnstarted();
timer.start();
R r = f.call();
timer.stop();
LoggerEnabler.logIfEnabled(logger, Level.INFO, timer.toString());
return r;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment