public class TimedBlock extends Object implements AutoCloseable
try (TimedBlock ignored = TimedBlock.timed("myBlock").aboveMillis(100).start()) {
// code to time, will only print timing info if it took 100ms or more
}
By default it will use its own logger to write timing information after the try-with-resources block exits.| Modifier and Type | Class and Description |
|---|---|
static class |
TimedBlock.Builder |
public static TimedBlock.Builder timed(String name)
public TimedBlock start()
public void close()
close in interface AutoCloseableCopyright © 2012–2014 TORCH GmbH. All rights reserved.