public interface Timer extends Metric
Metric for aggregating timing durations. Timing duration can be measured in following two ways:
update(long, TimeUnit) to add the duration to the Timer metric.
time(Callable) and Timer implementation will measure the time duration taken by
Callable.call().
| Modifier and Type | Method and Description |
|---|---|
TimeUnit |
getDurationUnit()
Returns the time unit at which event duration will be measured.
|
double |
getMax()
Returns the longest recorded duration.
|
double |
getMean()
Returns the arithmetic mean of all recorded durations.
|
double |
getMin()
Returns the shortest recorded duration.
|
TimeUnit |
getRateUnit()
Returns the time unit at which rate, event occurence will be measured.
|
double |
getStdDev()
Returns the standard deviation of all recorded durations.
|
<T> T |
time(Callable<T> event)
Times and records the duration of event.
|
void |
update(long duration,
TimeUnit unit)
Adds a recorded duration.
|
TimeUnit getRateUnit()
void update(long duration,
TimeUnit unit)
duration - the length of the durationunit - the scale unit of durationTimeUnit getDurationUnit()
<T> T time(Callable<T> event) throws Exception
T - the type of the value returned by eventevent - a Callable whose Callable.call() method implements a process whose duration should be timedeventException - if event throws an Exceptiondouble getMax()
double getMin()
double getMean()
double getStdDev()
Copyright © 2014 Cloud Software Group, Inc.. All Rights Reserved.