Package com.codahale.metrics
Class Clock
- java.lang.Object
-
- com.codahale.metrics.Clock
-
- Direct Known Subclasses:
Clock.CpuTimeClock,Clock.UserTimeClock
public abstract class Clock extends java.lang.ObjectAn abstraction for how time passes. It is passed toTimerto track timing.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classClock.CpuTimeClockA clock implementation which returns the current thread's CPU time.static classClock.UserTimeClockA clock implementation which returns the current time in epoch nanoseconds.
-
Constructor Summary
Constructors Constructor Description Clock()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static ClockdefaultClock()The default clock to use.abstract longgetTick()Returns the current time tick.longgetTime()Returns the current time in milliseconds.
-
-
-
Field Detail
-
DEFAULT
private static final Clock DEFAULT
-
-
Method Detail
-
getTick
public abstract long getTick()
Returns the current time tick.- Returns:
- time tick in nanoseconds
-
getTime
public long getTime()
Returns the current time in milliseconds.- Returns:
- time in milliseconds
-
defaultClock
public static Clock defaultClock()
The default clock to use.- Returns:
- the default
Clockinstance - See Also:
Clock.UserTimeClock
-
-