public interface Timer extends Meter
Modifier and Type | Interface and Description |
---|---|
static class |
Timer.Builder |
Meter.Id, Meter.Type
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.TimeUnit |
baseTimeUnit() |
static Timer.Builder |
builder(java.lang.String name) |
long |
count()
The number of times that record has been called on this timer.
|
double |
histogramCountAtValue(long valueNanos) |
double |
max(java.util.concurrent.TimeUnit unit)
The maximum time of a single event.
|
default double |
mean(java.util.concurrent.TimeUnit unit) |
default java.lang.Iterable<Measurement> |
measure()
Get a set of measurements.
|
double |
percentile(double percentile,
java.util.concurrent.TimeUnit unit)
The latency at a specific percentile.
|
default void |
record(java.time.Duration duration)
Updates the statistics kept by the counter with the specified amount.
|
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.
|
HistogramSnapshot |
takeSnapshot(boolean supportsAggregablePercentiles) |
double |
totalTime(java.util.concurrent.TimeUnit unit)
The total time of recorded events.
|
default Meter.Type |
type() |
default <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.default void record(java.time.Duration duration)
duration
- Duration of a single event being measured by this timer.<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.Exception
void 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.default <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 mean(java.util.concurrent.TimeUnit unit)
double max(java.util.concurrent.TimeUnit unit)
double percentile(double percentile, java.util.concurrent.TimeUnit unit)
double histogramCountAtValue(long valueNanos)
HistogramSnapshot takeSnapshot(boolean supportsAggregablePercentiles)
default java.lang.Iterable<Measurement> measure()
Meter
java.util.concurrent.TimeUnit baseTimeUnit()
default Meter.Type type()
static Timer.Builder builder(java.lang.String name)