[erlang-questions] System timers, now/0, and instrumentation

Richard O'Keefe <>
Wed May 25 08:45:22 CEST 2011


On 25/05/2011, at 7:09 AM, Jack Moffitt wrote:

>> The question is whether they are readily available. Sub-ms resolution timers
>> appear to be 'an exercise for the reader' for Windows developers, rather
>> than an OS-provided tool.
> 
> QueryPerformanceCounter() is pretty readily available as far as I
> remember. Here's something Google brought up for implementing
> microsecond timers with it:
> http://www.decompile.com/cpp/faq/windows_timer_api.htm

Er, there's a problem with the performance counters, isn't there?
now() is supposed to give you a clock, something that ticks
regularly.
The performance counters count events in the CPU, and today's
power-sensitive CPUs do things like scaling back the CPU clock
frequency when they think they aren't busy.

I know people keep telling me that time monitoring using cpu
cycle counters doesn't work any more; I can't say of my own knowledge
whether they are right.




More information about the erlang-questions mailing list