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

Ulf Wiger ulf.wiger@REDACTED
Sat May 9 22:27:42 CEST 2009


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.)

This would produce timestamped trace messages for 'in' and 'out'
events, i.e. the scheduling events per process.

Feed them into excel, after converting the erlang:now()-style
timestamps to some suitable unit (e.g. microseconds from T0),
and you can calculate the time spent in each process.

BR,
Ulf W

-- 
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com




More information about the erlang-questions mailing list