Modifier and Type | Interface and Description |
---|---|
static interface |
SimpleTimer.Context
A timing context.
|
Modifier and Type | Method and Description |
---|---|
long |
getCount()
Returns the current count.
|
java.time.Duration |
getElapsedTime()
Returns the total elapsed timing durations of all completed timing events that are recorded with
update(Duration) . |
java.time.Duration |
getMaxTimeDuration()
Get the maximum recorded time duration of the SimpleTimer for the previously completed full minute.
|
java.time.Duration |
getMinTimeDuration()
Get the minimum recorded time duration of the SimpleTimer for the previously completed full minute.
|
SimpleTimer.Context |
time()
Returns a new
SimpleTimer.Context . |
<T> T |
time(java.util.concurrent.Callable<T> event)
Times and records the duration of event.
|
void |
time(java.lang.Runnable event)
Times and records the duration of event.
|
void |
update(java.time.Duration duration)
Adds a recorded duration.
|
void update(java.time.Duration duration)
duration
- the length of the duration
<T> T time(java.util.concurrent.Callable<T> event) throws java.lang.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
java.lang.Exception
- if event
throws an Exception
void time(java.lang.Runnable event)
event
- a Runnable
whose Runnable.run()
method implements a process whose duration should be
timedSimpleTimer.Context time()
SimpleTimer.Context
.SimpleTimer.Context
SimpleTimer.Context
java.time.Duration getElapsedTime()
update(Duration)
.duration
long getCount()
Counting
java.time.Duration getMaxTimeDuration()
This represents the highest timed duration in the last completed full minute. For example if the last completed
full minute recorded durations of 12 seconds, 9 seconds and 1 second the largest value is 12 seconds.
If no time duration has been recorded in the last completed full minute then a null is returned. If there has
only been one time duration recorded in the last completed full minute then this value will be returned by both
getMaxTimeDuration()
and getMinTimeDuration()
java.time.Duration getMinTimeDuration()
This represents the lowest timed duration in the last completed full minute. For example if the last completed
full minute recorded durations of 12 seconds, 9 seconds and 1 second the lowest value is 1 second.
If no time duration has been recorded in the last completed full minute then a null is returned. If there has
only been one time duration recorded in the last completed full minute then this value will be returned by both
getMaxTimeDuration()
and getMinTimeDuration()