[erlang-questions] writing a delay loop without now()

James Hague james.hague@REDACTED
Sat Feb 21 17:48:23 CET 2009

> Right, this demonstrates the dependency of timer:sleep/1...
> And as we also established, this has nothing to do with Erlang -

Correct.  I just provided the numbers for os:sleep(1) and os:sleep(16)
for reference.

>  erlang:statistics(wall_clock),{test:time2(5000000),erlang:statistics(wall_clock)}.
> {{1295305,5000001},{241916,5000}}
> I.e. on the order of one call every 3.9 microseconds => no now/0 bumping
> occurs (you need to have more than one call per microsecond *on average*
> for that to have an effect on the total).

I get this:

This is using a 64-bit version of Window Vista, "Erlang (BEAM)
emulator version 5.6.5 [smp:4] [async-threads:0]".

I originally noticed this on a MacBook running OS X 10.4 (which is
Tiger, not 10.5 Leopard), but I don't have timings yet.  I also tried
disabling SMP on the Vista box, which gives:

More information about the erlang-questions mailing list