public interface Timer extends Metered, Sampling
Meter
.
See SimpleTimer
for a lightweight alternative that only tracks elapsed time
duration and count.
The timer measures duration in nanoseconds.Modifier and Type | Interface and Description |
---|---|
static interface |
Timer.Context
A timing context.
|
Modifier and Type | Method and Description |
---|---|
long |
getCount()
Returns the number of events which have been marked.
|
Duration |
getElapsedTime()
Returns the total elapsed timing durations of all completed timing events that are recorded with
update(Duration) . |
double |
getFifteenMinuteRate()
Returns the fifteen-minute exponentially-weighted moving average rate at which events have
occurred since the meter was created.
|
double |
getFiveMinuteRate()
Returns the five-minute exponentially-weighted moving average rate at which events have
occurred since the meter was created.
|
double |
getMeanRate()
Returns the mean rate at which events have occurred since the meter was created.
|
double |
getOneMinuteRate()
Returns the one-minute exponentially-weighted moving average rate at which events have
occurred since the meter was created.
|
Snapshot |
getSnapshot()
Returns a snapshot of the values.
|
Timer.Context |
time()
Returns a new
Timer.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.
|
void update(Duration duration)
duration
- the length of the duration
<T> T time(Callable<T> event) throws Exception
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
void time(Runnable event)
event
- a Runnable
whose Runnable.run()
method implements a process
whose duration should be timedTimer.Context time()
Timer.Context
.Timer.Context
Timer.Context
Duration getElapsedTime()
update(Duration)
.duration
long getCount()
Metered
double getFifteenMinuteRate()
Metered
top
Unix command.getFifteenMinuteRate
in interface Metered
double getFiveMinuteRate()
Metered
top
Unix command.getFiveMinuteRate
in interface Metered
double getMeanRate()
Metered
getMeanRate
in interface Metered
double getOneMinuteRate()
Metered
top
Unix command.getOneMinuteRate
in interface Metered
Snapshot getSnapshot()
Sampling
getSnapshot
in interface Sampling
Copyright © 2017 – 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.