[erlang-questions] wierd:statistic(runtime) and statistic(wall_clock)

mats cronqvist <>
Sun May 10 11:55:31 CEST 2009


Ulf Wiger <> writes:

> Oscar Hellström wrote:
>> 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.
>
> With a little work, it's possible to derive the quota
> per process, byt tracing on 'running' and 'timestamp' (preferrably
> 'cpu_timestamp', but it's not supported on all systems.)

  you'll also need 'garbage_collection' and 'procs' flags.

  i's more than a little work to get it right. for inspiration, here's
  an implementation (for OTP R7, possibly of archaeological interest
  only.)

  mats

 http://jungerl.cvs.sourceforge.net/viewvc/jungerl/jungerl/lib/pan/src/cb_perf.erl?revision=1.3&view=markup

  



More information about the erlang-questions mailing list