ch.aplu.util
Class HiResTimer

java.lang.Object
  extended by ch.aplu.util.BaseTimer
      extended by ch.aplu.util.HiResTimer

public class HiResTimer
extends BaseTimer

Timer with high resolution. (Resolution normally better than 1 microseconds.) The timer's accuracy is not garanteed because of multitasking/multithreading of operating system and Java. (All methods (except constructors) call yield() of the current thread unless disabled by special constructor.)


Constructor Summary
HiResTimer()
          Construct a HiResTimer object and set its time to zero.
HiResTimer(boolean autostart)
          Same as HiResTimer(), but the timer starts immediately if autostart is true.
HiResTimer(boolean autostart, boolean yield)
          Same as HiResTimer(autostart), but most methods calls Thread.yield() automatically, if yield is true.
 
Method Summary
 
Methods inherited from class ch.aplu.util.BaseTimer
delay, getTime, isRunning, reset, resume, start, stop
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HiResTimer

public HiResTimer()
Construct a HiResTimer object and set its time to zero. The timer must be started by calling start().


HiResTimer

public HiResTimer(boolean autostart)
Same as HiResTimer(), but the timer starts immediately if autostart is true.


HiResTimer

public HiResTimer(boolean autostart,
                  boolean yield)
Same as HiResTimer(autostart), but most methods calls Thread.yield() automatically, if yield is true. This may give a much better time response when using loops with an empty body like

while ( timer.isRunning() ) {}.