public class BasicTimer extends AbstractMonitor<java.lang.Long> implements Timer, CompositeMonitor<java.lang.Long>
config| Constructor and Description |
|---|
BasicTimer(MonitorConfig config)
Creates a new instance of the timer with a unit of milliseconds.
|
BasicTimer(MonitorConfig config,
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()
Get the total number of updates.
|
java.lang.Double |
getMax()
Get the max value since the last reset.
|
java.lang.Double |
getMin()
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.Double |
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)
Deprecated.
|
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, getValuepublic BasicTimer(MonitorConfig config)
public BasicTimer(MonitorConfig config, 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@Deprecated 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.Double getTotalTime()
public java.lang.Long getCount()
public java.lang.Double getMin()
public java.lang.Double getMax()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object