public interface Timer extends Meter
| Modifier and Type | Interface and Description |
|---|---|
static interface |
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.
|
default Meter.Type |
getType() |
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.
|
default double |
totalTimeNanos()
The total time in nanoseconds 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. |
default java.lang.Runnable |
wrap(java.lang.Runnable f)
Wrap a
Runnable so that it is timed when invoked. |
void record(long amount,
java.util.concurrent.TimeUnit unit)
amount - Duration of a single event being measured by this timer. If the amount is less than 0
the value will be dropped.unit - Time unit for the amount being recorded.<T> T record(java.util.function.Supplier<T> f)
f - Function to execute and measure the execution time.<T> T recordCallable(java.util.concurrent.Callable<T> f)
throws java.lang.Exception
f - Function to execute and measure the execution time.java.lang.Exceptionvoid record(java.lang.Runnable f)
f - Function to execute and measure the execution time.default java.lang.Runnable wrap(java.lang.Runnable f)
Runnable so that it is timed when invoked.f - The Runnable to time when it is invoked.<T> java.util.concurrent.Callable<T> wrap(java.util.concurrent.Callable<T> f)
Callable so that it is timed when invoked.f - The Callable to time when it is invoked.long count()
double totalTime(java.util.concurrent.TimeUnit unit)
default double totalTimeNanos()
default Meter.Type getType()