@Vetoed public class TimerImpl extends Object implements org.eclipse.microprofile.metrics.Timer
Meter
.
The timer measures duration in nanoseconds.Modifier and Type | Class and Description |
---|---|
static class |
TimerImpl.Context
A timing context.
|
Constructor and Description |
---|
TimerImpl()
|
TimerImpl(Reservoir reservoir)
|
TimerImpl(Reservoir reservoir,
Clock clock)
|
Modifier and Type | Method and Description |
---|---|
long |
getCount() |
double |
getFifteenMinuteRate() |
double |
getFiveMinuteRate() |
double |
getMeanRate() |
double |
getOneMinuteRate() |
org.eclipse.microprofile.metrics.Snapshot |
getSnapshot() |
TimerImpl.Context |
time()
Returns a new
TimerImpl.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(long duration,
TimeUnit unit)
Adds a recorded duration.
|
public TimerImpl()
public TimerImpl(Reservoir reservoir)
reservoir
- the Reservoir
implementation the timer should
usepublic void update(long duration, TimeUnit unit)
update
in interface org.eclipse.microprofile.metrics.Timer
duration
- the length of the durationunit
- the scale unit of duration
public <T> T time(Callable<T> event) throws Exception
time
in interface org.eclipse.microprofile.metrics.Timer
T
- the type of the value returned by event
event
- a Callable
whose Callable.call()
method
implements a process whose duration should be timedevent
Exception
- if event
throws an Exception
public void time(Runnable event)
time
in interface org.eclipse.microprofile.metrics.Timer
event
- a Runnable
whose Runnable.run()
method
implements a process whose duration should be timedpublic TimerImpl.Context time()
TimerImpl.Context
.time
in interface org.eclipse.microprofile.metrics.Timer
TimerImpl.Context
TimerImpl.Context
public long getCount()
getCount
in interface org.eclipse.microprofile.metrics.Counting
getCount
in interface org.eclipse.microprofile.metrics.Metered
getCount
in interface org.eclipse.microprofile.metrics.Timer
public double getFifteenMinuteRate()
getFifteenMinuteRate
in interface org.eclipse.microprofile.metrics.Metered
getFifteenMinuteRate
in interface org.eclipse.microprofile.metrics.Timer
public double getFiveMinuteRate()
getFiveMinuteRate
in interface org.eclipse.microprofile.metrics.Metered
getFiveMinuteRate
in interface org.eclipse.microprofile.metrics.Timer
public double getMeanRate()
getMeanRate
in interface org.eclipse.microprofile.metrics.Metered
getMeanRate
in interface org.eclipse.microprofile.metrics.Timer
public double getOneMinuteRate()
getOneMinuteRate
in interface org.eclipse.microprofile.metrics.Metered
getOneMinuteRate
in interface org.eclipse.microprofile.metrics.Timer
public org.eclipse.microprofile.metrics.Snapshot getSnapshot()
getSnapshot
in interface org.eclipse.microprofile.metrics.Sampling
getSnapshot
in interface org.eclipse.microprofile.metrics.Timer
Copyright © 2018. All rights reserved.