Package org.eclipse.microprofile.metrics
Interface SimpleTimer
A simple timer metric which tracks elapsed time durations and count.
This is a lightweight alternative to (@link Timer).
The simple timer measures duration in nanoseconds.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
getCount()
Returns the current count.Returns the total elapsed timing durations of all completed timing events that are recorded withupdate(Duration)
.time()
Returns a newSimpleTimer.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
SimpleTimer.Context time()Returns a newSimpleTimer.Context
.- Returns:
- a new
SimpleTimer.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()Description copied from interface:Counting
Returns the current count.
-