Timer.Builder
Meter.Type
Modifier and Type | Method and Description |
---|---|
long |
count()
The number of times that record has been called since this timer was created.
|
void |
record(long amount,
java.util.concurrent.TimeUnit unit)
Updates the statistics kept by the counter with the specified amount.
|
void |
record(java.lang.Runnable f)
Executes the runnable `f` and records the time taken.
|
<T> T |
record(java.util.function.Supplier<T> f)
Executes the Supplier `f` and records the time taken.
|
<T> T |
recordCallable(java.util.concurrent.Callable<T> f)
Executes the callable `f` and records the time taken.
|
double |
totalTime(java.util.concurrent.TimeUnit unit)
The total time of all recorded events since this timer was created.
|
<T> java.util.concurrent.Callable<T> |
wrap(java.util.concurrent.Callable<T> f)
Wrap a
Callable so that it is timed when invoked. |
getDescription, getName, getTags, measure
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getType, measure, totalTimeNanos, wrap
getDescription, getName, getTags
public static final NoopTimer INSTANCE
public void record(long amount, java.util.concurrent.TimeUnit unit)
Timer
public <T> T record(java.util.function.Supplier<T> f)
Timer
public <T> T recordCallable(java.util.concurrent.Callable<T> f) throws java.lang.Exception
Timer
recordCallable
in interface Timer
f
- Function to execute and measure the execution time.java.lang.Exception
public void record(java.lang.Runnable f)
Timer
public <T> java.util.concurrent.Callable<T> wrap(java.util.concurrent.Callable<T> f)
Timer
Callable
so that it is timed when invoked.public long count()
Timer