[erlang-questions] wierd:statistic(runtime) and statistic(wall_clock)
Oscar Hellström
oscar@REDACTED
Sat May 9 20:57:29 CEST 2009
Hi Junli,
Please keep in mind that Erlang will use all your processor cores. The
wall_clock time is the time spend since your program started, as if you
were checking with a clock on your wall. runtime is the time spent on
the CPU. If there is more than one CPU, runtime can be more than
wall_clock. This is the same for any multi threaded C program (see
attached, compile with -lpthreads and run with time ./executable).
statistics/1 will give you statistics for the VM though, and not for one
erlang process. You can probably use either timer:tc/3 or now/0 together
with timer:now_diff/2 to find out how much wall time time a process has
used, but I don't know how you would get the run time, since the run
time could be less if you have several processes running in the system.
junli gu wrote:
> we have two ways to get time :statistic(*runtime*) and
> statistic(wall_clock).I have not find any exact desciption about the two
> methods.
> Some one have guessed:"Since erlang is not
> guaranteed to have 100% of your CPU time, *runtime* would be the actual
> amount
> of processing time used by erlang. "wall_clock" time is simply recording
> the
> actual time the process started and the actual time the process ended and
> giving you the difference in "real time" ."
>
> So we can came to the conclusion that *runtime* is less than
> wall_clock.I did some experiments to verify this,the result is really
> wired that I can't understand: *runtime* is probably both more or less
> than wall_clock! Waht's happenging? Would some one explain this?
> process spawn average time =*runtime* <wall_clock> us
> process spawn average time =1.5 <3.2> us
> process spawn average time =3.44 <2.5> us
>
> just wondering how to get the exact time that my process needed……
>
> --
> ************************************************
> Gu Junli--谷俊丽
> PHD Candidate of Tsinghua University
> Beijing 100084,China
> Tel: 86-10-62795139
>
> ************************************************
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
Best regards
--
Oscar Hellström, oscar@REDACTED
Phone: +44 (0)798 45 44 773
Mobile: +44 (0)207 65 50 337
Web: http://www.erlang-consulting.com
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: thread.c
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090509/e7b49cec/attachment.c>
More information about the erlang-questions
mailing list