- All Superinterfaces:
HistogramSupport
,Meter
,Wrapper
Records timing information about large numbers of short-running events (e.g., HTTP requests).
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Builder for a newTimer
.static interface
Measures 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.Builder
Creates a builder for a newTimer
.long
count()
Returns the current count of completed events measured by the timer.double
Returns the maximum value, expressed in the specified units, consumed by a completed event measured by the timer.double
Returns the average time, expressed in the specified units, consumed by completed events measured by the timer.void
Updates the statistics kept by the timer with the specified amount.void
Executes theRunnable
f
and records the time it takes.void
Updates the statistics kept by the timer with the specified amount.<T> T
Executes theCallable
f
and records the time spent it, returning the callable's result.<T> T
Executes theSupplier
f
and records the time spent invoking the function.static Timer.Sample
start()
Starts a timing sample using the default system clock.static Timer.Sample
Starts a timing sample using the specified clock.static Timer.Sample
start
(MeterRegistry registry) Starts a timing sample using the clock associated with the specifiedMeterRegistry
.double
Returns the total time, expressed in the specified units, consumed by completed events measured by the timer.Wraps aRunnable
so that it will be timed every time it is invoked via the return value from this method.<T> Callable
<T> Wraps aCallable
so that it is will be timed every time it is invoked via the return value from this method.<T> Supplier
<T> Wraps aSupplier
so 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 theSupplier
f
and 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 theCallable
f
and records the time spent it, returning the callable's result. -
record
Executes theRunnable
f
and records the time it takes.- Parameters:
f
- runnable to be timed
-
wrap
Wraps aRunnable
so 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 aCallable
so 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 aSupplier
so that it will be timed every time it is invoked via the return value from this method.- Type Parameters:
T
- return type of theSupplier
result- Parameters:
f
-Supplier
to 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
-