- All Superinterfaces:
HistogramSupport,Meter,Wrapper
Accumulates timing information about large numbers of short-running events (e.g., HTTP requests), each with a
Duration value, and reports statistics over all samples (count, total time, mean, max) as well as grouping
samples using percentiles or bucket boundaries.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilder for a newTimer.static interfaceMeasures an interval of time from instantiation to an explicit invocation ofTimer.Sample.stop(io.helidon.metrics.api.Timer).Nested classes/interfaces inherited from interface io.helidon.metrics.api.Meter
Meter.BaseUnits, Meter.Id, Meter.Scope, Meter.Type -
Method Summary
Modifier and TypeMethodDescriptionstatic Timer.BuilderCreates a builder for a newTimer.longcount()Returns the current count of completed events measured by the timer.doubleReturns the maximum value, expressed in the specified units, consumed by a completed event measured by the timer.doubleReturns the average time, expressed in the specified units, consumed by completed events measured by the timer.voidUpdates the statistics kept by the timer with the specified amount.voidExecutes theRunnablefand records the time it takes.voidUpdates the statistics kept by the timer with the specified amount.<T> TExecutes theCallablefand records the time spent it, returning the callable's result.<T> TExecutes theSupplierfand records the time spent invoking the function.static Timer.Samplestart()Starts a timing sample using the default system clock.static Timer.SampleStarts a timing sample using the specified clock.static Timer.Samplestart(MeterRegistry registry) Starts a timing sample using the clock associated with the specifiedMeterRegistry.doubleReturns the total time, expressed in the specified units, consumed by completed events measured by the timer.Wraps aRunnableso that it will be timed every time it is invoked via the return value from this method.<T> Callable<T> Wraps aCallableso that it is will be timed every time it is invoked via the return value from this method.<T> Supplier<T> Wraps aSupplierso that it will be timed every time it is invoked via the return value from this method.Methods inherited from interface io.helidon.metrics.api.HistogramSupport
snapshot
-
Method Details
-
builder
Creates a builder for a newTimer.- Parameters:
name- timer name- Returns:
- new builder
-
start
Starts a timing sample using the default system clock.- Returns:
- new sample
-
start
Starts a timing sample using the clock associated with the specifiedMeterRegistry.- Parameters:
registry- the meter registry whose clock is to be used for measuring the interval- Returns:
- new sample with start time recorded
-
start
Starts a timing sample using the specified clock.- Parameters:
clock- a clock to be used- Returns:
- new sample with start time recorded
-
record
Updates the statistics kept by the timer with the specified amount.- Parameters:
amount- duration of a single event being measured by this timer. If the amount is less than 0 the value will be droppedunit- time unit for the amount being recorded
-
record
Updates the statistics kept by the timer with the specified amount.- Parameters:
duration- duration of a single event being measured by this timer
-
record
Executes theSupplierfand records the time spent invoking the function.- Type Parameters:
T- return type of theSupplier- Parameters:
f- function to be timed- Returns:
- return value from invoking the function
f
-
record
Executes theCallablefand records the time spent it, returning the callable's result. -
record
Executes theRunnablefand records the time it takes.- Parameters:
f- runnable to be timed
-
wrap
Wraps aRunnableso that it will be timed every time it is invoked via the return value from this method.- Parameters:
f- runnable to time when it is invoked- Returns:
- the wrapped runnable
-
wrap
Wraps aCallableso that it is will be timed every time it is invoked via the return value from this method.- Type Parameters:
T- return type of the callable- Parameters:
f- callable to time when it is invoked- Returns:
- the wrapped callable
-
wrap
Wraps aSupplierso that it will be timed every time it is invoked via the return value from this method.- Type Parameters:
T- return type of theSupplierresult- Parameters:
f-Supplierto time when it is invoked- Returns:
- the wrapped supplier
-
count
long count()Returns the current count of completed events measured by the timer.- Returns:
- number of events recorded by the timer
-
totalTime
Returns the total time, expressed in the specified units, consumed by completed events measured by the timer.- Parameters:
unit- time unit in which to express the total accumulated time- Returns:
- total time of recorded events
-
mean
Returns the average time, expressed in the specified units, consumed by completed events measured by the timer.- Parameters:
unit- time unit in which to express the mean- Returns:
- average for all events recorded by this timer
-
max
Returns the maximum value, expressed in the specified units, consumed by a completed event measured by the timer.- Parameters:
unit- time unit in which to express the maximum- Returns:
- maximum time recorded by a single event measured by this timer
-