public class BucketTimer extends AbstractMonitor<java.lang.Long> implements Timer, CompositeMonitor<java.lang.Long>
config
Constructor and Description |
---|
BucketTimer(MonitorConfig config,
BucketConfig bucketConfig)
Creates a new instance of the timer with a unit of milliseconds.
|
BucketTimer(MonitorConfig config,
BucketConfig bucketConfig,
java.util.concurrent.TimeUnit unit)
Creates a new instance of the timer.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.Long |
getCount(int pollerIndex)
Get the total number of updates.
|
java.lang.Long |
getMax(int pollerIndex)
Get the max value since the last reset.
|
java.lang.Long |
getMin(int pollerIndex)
Get the min value since the last reset.
|
java.util.List<Monitor<?>> |
getMonitors()
Returns a list of sub-monitors for this composite.
|
java.util.concurrent.TimeUnit |
getTimeUnit()
The time unit reported by this timer.
|
java.lang.Long |
getTotalTime()
Get the total time for all updates.
|
java.lang.Long |
getValue(int pollerIndex)
Returns the current value for the monitor for the nth poller.
|
int |
hashCode() |
void |
record(long duration)
Record a new value for this timer.
|
void |
record(long duration,
java.util.concurrent.TimeUnit unit)
Record a new value that was collected with the given TimeUnit.
|
Stopwatch |
start()
Returns a stopwatch that has been started and will automatically
record its result to this timer when stopped.
|
java.lang.String |
toString() |
getConfig, getValue
public BucketTimer(MonitorConfig config, BucketConfig bucketConfig)
public BucketTimer(MonitorConfig config, BucketConfig bucketConfig, java.util.concurrent.TimeUnit unit)
public java.util.List<Monitor<?>> getMonitors()
getMonitors
in interface CompositeMonitor<java.lang.Long>
public Stopwatch start()
public java.util.concurrent.TimeUnit getTimeUnit()
getTimeUnit
in interface Timer
public void record(long duration)
public void record(long duration, java.util.concurrent.TimeUnit unit)
public java.lang.Long getValue(int pollerIndex)
public java.lang.Long getTotalTime()
public java.lang.Long getCount(int pollerIndex)
public java.lang.Long getMin(int pollerIndex)
public java.lang.Long getMax(int pollerIndex)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object