Interface Timer
-
- All Known Implementing Classes:
AbstractIntervalTimer,CpuRatioTimer
public interface TimerTimeris a base interface for various timer implementations provided in this package. Each of them can be started and stopped, and can return the total elapsed time, however each implementation will interpret elapsed time differently (e.g. wall time, user time, system time, etc.). This was inspired by and loosely based on //google3/base/timer.h.- See Also:
TimerFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longgetNanoseconds()Get the number of nanoseconds that elapsed between when theTimerwas started and when it was stopped.voidstart()Start the timer running.voidstop()Stop the timer.voidupdate()Update any internal state.
-
-
-
Method Detail
-
start
void start()
Start the timer running.- Throws:
IllegalStateException- If it was already running.
-
stop
void stop()
Stop the timer.- Throws:
IllegalStateException- If it was not running.
-
getNanoseconds
long getNanoseconds()
Get the number of nanoseconds that elapsed between when theTimerwas started and when it was stopped. Note that the return value has nanosecond precision but not necessarily nanosecond accuracy.
-
update
void update()
-
-