Re: [HighResolutionTime] New worker tests added

Regarding: http://www.w3.org/TR/hr-time/

One useful consideration about high-resolution timers (HRT) on some
platforms is that if you read a HRT from one thread, then the thread
undergoes a context-switch to a different processor core on a CPU, you may
get a few microseconds difference in the HRT.  In rare cases, you may even
get a "backwards tick".

To solve the backwards tick problem, sometimes these techniques have been
used:
(1) Use thread affinity, to read the HRT only via the same core.
(2) Compare the tick value to the previous tick, and reject the backwards
tick.  Reuse the previous tick value instead.  Resume measurements with
subsequent reads.

The HRT usually remains constantly monotonic even whenever the clock is
changed (e.g. synchronized to an Internet time server), but make sure
that's correct.  This may be a nonissue for Windows
QueryPerformanceCounter() which always increases monotonically on the same
CPU core -- but it does have the potential microsecond differences between
different cores, so you want either thread affinity or a backwards-tick
check & reject (use old value).

Thanks,
Mark Rejhon
Blur Busters Blog

Received on Sunday, 4 August 2013 11:53:13 UTC