[erlang-questions] Measure all reductions in system

Max Lapshin max.lapshin@REDACTED
Thu Jun 9 15:33:37 CEST 2016


I want to try to understand where does erlang spend time and CPU running my
program.

What do I try to do for it:

1) run erlang:statistics(reductions)  before loop
2) run erlang:trace(all, true, [running])
3) start collecting messages
For each

{trace,Pid,in,_} and {trace,Pid,out,_}

I take process_info(Pid, reductions)  and remember first seen reduction
count from process and update last seen reduction count from process
4) after some time passes I stop this collection and sum all seen deltas
between first seen reduction count and last seen reduction count for all
processes

5) when I compare sum of reduction delta  and numbers from
statistics(reduction) I see that during 5 seconds sum is 152 242 208  and
statistics is 802 940 107


Here is my code:
https://gist.github.com/maxlapshin/bab46e137d81460672d133bf0cb46a16

Why do I see such difference?

Where do I loose reduction count in processes?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160609/dd3ab8e0/attachment.htm>


More information about the erlang-questions mailing list