Package com.codahale.metrics
Class Timer.Context
- java.lang.Object
-
- com.codahale.metrics.Timer.Context
-
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
- Timer
public static class Timer.Context extends Object implements AutoCloseable
A timing context.- See Also:
Timer.time()
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Equivalent to callingstop()
.long
stop()
Updates the timer with the difference between current and start time.
-
-
-
Method Detail
-
stop
public long stop()
Updates the timer with the difference between current and start time. Call to this method will not reset the start time. Multiple calls result in multiple updates.- Returns:
- the elapsed time in nanoseconds
-
close
public void close()
Equivalent to callingstop()
.- Specified by:
close
in interfaceAutoCloseable
-
-