|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.e2etrace.timer.DefaultTimer
public class DefaultTimer
Default ITimer
implementation.
This implementation uses System.currentTimeMillis()
to measure the
duration between the start()
and measure()
calls on the timer. The advantage of this approach is that it works with all
JDK releases. The disadvantage is that the accuracy of
currentTimeMillis
depends on the underlying operating systems.
On Windows, for example, currentTimeMillis
will typically
provide an accuracy of about 10ms, which is too coarse for measuring short
intervals. However, on Linux the accuracy is 1ms, which is exactly what we
want. For details on this issue, please refer to the article "My kingdom for
a good timer!" by Vladimir Roubtsov on JavaWorld (see link below).
Method Summary | |
---|---|
long |
measure()
Returns the duration in ms since start() . |
void |
start()
Starts the timer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void start()
start
in interface ITimer
public long measure()
start()
.
measure
in interface ITimer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |