public class SimpleTimerImpl extends Object implements org.eclipse.microprofile.metrics.SimpleTimer
| Modifier and Type | Class and Description |
|---|---|
static class |
SimpleTimerImpl.Context
A timing context.
|
| Constructor and Description |
|---|
SimpleTimerImpl()
Creates a new
SimpleTimerImpl using the default Clock. |
SimpleTimerImpl(Clock clock)
Creates a new
SimpleTimerImpl that uses the given Clock. |
| Modifier and Type | Method and Description |
|---|---|
long |
getCount() |
Duration |
getElapsedTime() |
SimpleTimerImpl.Context |
time()
Returns a new
SimpleTimerImpl.Context. |
<T> T |
time(Callable<T> event)
Times and records the duration of event.
|
void |
time(Runnable event)
Times and records the duration of event.
|
void |
update(Duration duration)
Adds a recorded duration.
|
public SimpleTimerImpl()
SimpleTimerImpl using the default Clock.public SimpleTimerImpl(Clock clock)
SimpleTimerImpl that uses the given Clock.clock - the Clock implementation the timer should usepublic void update(Duration duration)
update in interface org.eclipse.microprofile.metrics.SimpleTimerduration - the length of the durationpublic <T> T time(Callable<T> event) throws Exception
time in interface org.eclipse.microprofile.metrics.SimpleTimerT - the type of the value returned by eventevent - a Callable whose Callable.call() method implements a process
whose duration should be timedeventException - if event throws an Exceptionpublic void time(Runnable event)
time in interface org.eclipse.microprofile.metrics.SimpleTimerevent - a Runnable whose Runnable.run() method implements a process
whose duration should be timedpublic SimpleTimerImpl.Context time()
SimpleTimerImpl.Context.time in interface org.eclipse.microprofile.metrics.SimpleTimerSimpleTimerImpl.ContextSimpleTimerImpl.Contextpublic Duration getElapsedTime()
getElapsedTime in interface org.eclipse.microprofile.metrics.SimpleTimerpublic long getCount()
getCount in interface org.eclipse.microprofile.metrics.CountinggetCount in interface org.eclipse.microprofile.metrics.SimpleTimerCopyright © 2018–2020. All rights reserved.