public abstract class AbstractTimer extends AbstractMeter implements Timer
Timer.Builder, Timer.SampleMeter.Id, Meter.Type| Modifier and Type | Field and Description |
|---|---|
protected Clock |
clock |
protected Histogram |
histogram |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractTimer(Meter.Id id,
Clock clock,
DistributionStatisticConfig distributionStatisticConfig,
PauseDetector pauseDetector,
java.util.concurrent.TimeUnit baseTimeUnit,
boolean supportsAggregablePercentiles) |
| Modifier and Type | Method and Description |
|---|---|
java.util.concurrent.TimeUnit |
baseTimeUnit() |
void |
close() |
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
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) |
HistogramSnapshot |
takeSnapshot()
Summary statistics should be published off of a single snapshot instance so that, for example, there isn't
disagreement between the distribution's bucket counts because more events continue to stream in.
|
getIdclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitbuilder, builder, count, histogramCountAtValue, max, mean, measure, percentile, record, start, start, totalTime, wrap, wraptakeSnapshotprotected AbstractTimer(Meter.Id id, Clock clock, DistributionStatisticConfig distributionStatisticConfig, PauseDetector pauseDetector, java.util.concurrent.TimeUnit baseTimeUnit, boolean supportsAggregablePercentiles)
public <T> T recordCallable(java.util.concurrent.Callable<T> f)
throws java.lang.Exception
TimerrecordCallable in interface TimerT - The return type of the Callable.f - Function to execute and measure the execution time.java.lang.Exception - Any exception bubbling up from the callable.public <T> T record(java.util.function.Supplier<T> f)
Timerpublic void record(java.lang.Runnable f)
Timerpublic final void record(long amount,
java.util.concurrent.TimeUnit unit)
Timerprotected abstract void recordNonNegative(long amount,
java.util.concurrent.TimeUnit unit)
public HistogramSnapshot takeSnapshot()
HistogramSupporttakeSnapshot in interface HistogramSupportpublic java.util.concurrent.TimeUnit baseTimeUnit()
baseTimeUnit in interface Timerpublic boolean equals(@Nullable java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object