Package org.eclipse.microprofile.metrics
Interface Timer
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceTimer.ContextA timing context.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longgetCount()DurationgetElapsedTime()Returns the total elapsed timing durations of all completed timing events that are recorded withupdate(Duration).SnapshotgetSnapshot()Returns a snapshot of the values.Timer.Contexttime()Returns a newTimer.Context.voidtime(Runnable event)Times and records the duration of event.<T> Ttime(Callable<T> event)Times and records the duration of event.voidupdate(Duration duration)Adds a recorded duration.
-
-
-
Method Detail
-
update
void update(Duration duration)
Adds a recorded duration.- Parameters:
duration- the length of theduration
-
time
<T> T time(Callable<T> event) throws Exception
Times and records the duration of event.- Type Parameters:
T- the type of the value returned byevent- Parameters:
event- aCallablewhoseCallable.call()method implements a process whose duration should be timed- Returns:
- the value returned by
event - Throws:
Exception- ifeventthrows anException
-
time
void time(Runnable event)
Times and records the duration of event.- Parameters:
event- aRunnablewhoseRunnable.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:
Timer.Context
-
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:SamplingReturns a snapshot of the values.- Specified by:
getSnapshotin interfaceSampling- Returns:
- a snapshot of the values
-
-