public abstract class AbstractTimer extends AbstractMeter implements Timer
Timer.Builder
Meter.Id, Meter.Type
Modifier and Type | Field and Description |
---|---|
protected Clock |
clock |
protected TimeWindowLatencyHistogram |
histogram |
Modifier | Constructor and Description |
---|---|
protected |
AbstractTimer(Meter.Id id,
Clock clock,
HistogramConfig histogramConfig,
PauseDetector pauseDetector,
java.util.concurrent.TimeUnit baseTimeUnit) |
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.TimeUnit |
baseTimeUnit() |
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
double |
histogramCountAtValue(long valueNanos) |
double |
percentile(double percentile,
java.util.concurrent.TimeUnit unit)
The latency at a specific percentile.
|
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.
|
protected abstract void |
recordNonNegative(long amount,
java.util.concurrent.TimeUnit unit) |
HistogramConfig |
statsConfig() |
HistogramSnapshot |
takeSnapshot(boolean supportsAggregablePercentiles) |
getId
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
protected final Clock clock
protected final TimeWindowLatencyHistogram histogram
protected AbstractTimer(Meter.Id id, Clock clock, HistogramConfig histogramConfig, PauseDetector pauseDetector, java.util.concurrent.TimeUnit baseTimeUnit)
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 <T> T record(java.util.function.Supplier<T> f)
Timer
public void record(java.lang.Runnable f)
Timer
public final void record(long amount, java.util.concurrent.TimeUnit unit)
Timer
protected abstract void recordNonNegative(long amount, java.util.concurrent.TimeUnit unit)
public double percentile(double percentile, java.util.concurrent.TimeUnit unit)
Timer
percentile
in interface Timer
public double histogramCountAtValue(long valueNanos)
histogramCountAtValue
in interface Timer
public HistogramSnapshot takeSnapshot(boolean supportsAggregablePercentiles)
takeSnapshot
in interface Timer
public java.util.concurrent.TimeUnit baseTimeUnit()
baseTimeUnit
in interface Timer
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public HistogramConfig statsConfig()