I do not know if it is helpful or not, but with R12B-5 on an AMD Turion running Arch Linux I consistently get around 5001 milliseconds both with and without hipe. "erl -smp disable" gives the same results.<br><br>
Erlang (BEAM) emulator version 5.6.5 [source] [64-bit] [smp:2] [async-threads:0] [hipe] [kernel-poll:false]<br><br>Eshell V5.6.5 (abort with ^G)<br>1> erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock).<br>
{18066,5001}<br>2> erlang:statistics(wall_clock),test:time(1000),erlang:statistics(wall_clock).<br>{200733,2}<br>3> erlang:statistics(wall_clock),test:time(1000),erlang:statistics(wall_clock).<br>{202005,2}<br>4> erlang:statistics(wall_clock),test:time(1000),erlang:statistics(wall_clock).<br>
{203189,2}<br><br>BR /Fredrik<br><br><div class="gmail_quote">On Sat, Feb 21, 2009 at 12:43 AM, James Hague <span dir="ltr"><<a href="mailto:james.hague@gmail.com">james.hague@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
All right, here's a simple case. I hope I'm not doing something dumb<br>
here. This is only to illustrate one issue; it's not a full analysis<br>
of timing in Erlang.<br>
<br>
First, try this from the shell:<br>
<br>
erlang:statistics(wall_clock),timer:sleep(5000),erlang:statistics(wall_clock).<br>
<br>
I get {57018,5007} which is just about five seconds (the second number<br>
is the elapsed time between calls. The parameter to sleep is in<br>
MILLIseconds. (Note that if I change 5000 to 1, I get a result of 16<br>
milliseconds elapsed on the machine I'm using at the moment. If I<br>
change it to 16, I get a result of 31 milliseconds.)<br>
<br>
Now here's a little function that uses now/0 and timer:now_diff/2 to<br>
wait for a specified number of MICROseconds:<br>
<br>
-module(test).<br>
-compile(export_all).<br>
<br>
time(N) -> time(N, now()).<br>
time(N, Start) -><br>
case timer:now_diff(now(), Start) of<br>
M when M >= N -> M;<br>
_ -> time(N, Start)<br>
end.<br>
<br>
Now try it from the shell:<br>
<br>
erlang:statistics(wall_clock),test:time(5000000),erlang:statistics(wall_clock).<br>
<br>
I get {836723,1310} on the same machine. 1.3 seconds.<br>
<div><div></div><div class="Wj3C7c">_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br>