Interface Timer
- All Known Implementing Classes:
AbstractIntervalTimer,CpuRatioTimer
public interface Timer
Timer is 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:
-
Method Details
-
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()
-