com.yammer.metrics.core
Class Clock

java.lang.Object
  extended by com.yammer.metrics.core.Clock
Direct Known Subclasses:
Clock.CpuTime, Clock.UserTime

public abstract class Clock
extends Object

An abstraction for how time passes. It is passed to TimerMetric to track timing.


Nested Class Summary
static class Clock.CpuTime
          Another implementation, uses ThreadMXBean.getCurrentThreadCpuTime()
static class Clock.UserTime
          Default implementation, uses System.nanoTime().
 
Field Summary
static Clock DEFAULT
          The default clock to use.
 
Constructor Summary
Clock()
           
 
Method Summary
abstract  long tick()
          Gets the current time tick
 long time()
          Gets the current time in milliseconds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final Clock DEFAULT
The default clock to use.

Constructor Detail

Clock

public Clock()
Method Detail

tick

public abstract long tick()
Gets the current time tick

Returns:
time tick in nanoseconds

time

public long time()
Gets the current time in milliseconds

Returns:
time in milliseconds


Copyright © 2011. All Rights Reserved.