Package org.eclipse.microprofile.metrics
Interface Timer
A timer metric which aggregates timing durations and provides duration statistics
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
getCount()
Returns the total elapsed timing durations of all completed timing events that are recorded withupdate(Duration)
.Returns a snapshot of the values.time()
Returns a newTimer.Context
.void
Times and records the duration of event.<T> T
Times and records the duration of event.void
Adds a recorded duration.
-
Method Details
-
update
Adds a recorded duration.- Parameters:
duration
- the length of theduration
-
time
Times and records the duration of event.- Type Parameters:
T
- the type of the value returned byevent
- Parameters:
event
- aCallable
whoseCallable.call()
method implements a process whose duration should be timed- Returns:
- the value returned by
event
- Throws:
Exception
- ifevent
throws anException
-
time
Times and records the duration of event.- Parameters:
event
- aRunnable
whoseRunnable.run()
method implements a process whose duration should be timed
-
time
Timer.Context time()Returns a newTimer.Context
.- Returns:
- a new
Timer.Context
- See Also:
-
getElapsedTime
Duration getElapsedTime()Returns the total elapsed timing durations of all completed timing events that are recorded withupdate(Duration)
.- Returns:
- the elapsed time
duration
-
getCount
long getCount() -
getSnapshot
Snapshot getSnapshot()Description copied from interface:Sampling
Returns a snapshot of the values.- Specified by:
getSnapshot
in interfaceSampling
- Returns:
- a snapshot of the values
-