Interface SimpleTimer
-
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)
.Get the maximum recorded time duration of the SimpleTimer for the previously completed full minute.Get the minimum recorded time duration of the SimpleTimer for the previously completed full minute.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. -
getMaxTimeDuration
Duration getMaxTimeDuration()Get the maximum recorded time duration of the SimpleTimer for the previously completed full minute.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()
andgetMinTimeDuration()
- Returns:
- The maximum recorded time duration in the previously completed full minute or null if no values were recorded
-
getMinTimeDuration
Duration getMinTimeDuration()Get the minimum recorded time duration of the SimpleTimer for the previously completed full minute.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()
andgetMinTimeDuration()
- Returns:
- The minimum recorded time duration in the previously completed full minute or null if no values were recorded
-