[erlang-questions] Differences between erlang:system_profile and erlang:trace

Magnus Klaar magnus.klaar@REDACTED
Tue Jan 3 01:37:12 CET 2012


I'm seeing a strange behavior when using erlang:system_info/2 to trace the
running processes on an erlang node. I know it's flagged as experimental so
I will assume it's actually a feature even if the documentation does not
agree. When a process is used to receive the profile messages from
erlang:system_info/2 the receiving process is also profiled. The effect of
this is that the process receiving the profile messages will receive an
infinite sequence of 'inactive' ... 'active' ... 'inactive' .... messages
from the runtime system. The manpage states that the "The receiver is
excluded from all profiling.". I've compared this with using the
erlang:trace/3 function to trace running processes, when this function is
used the tracer processes never receives a message when the tracer process

Two eunit tests for showing the difference:  https://gist.github.com/1552673

Running "erl -noshell -s system_profile test -s init stop" on my system
yields the following result:

system_profile.erl:30:<0.35.0>: Total: 525169, For tracer: 524824, For
others: 345

system_profile:13: system_profile_test_...*failed*
                   {expression,"SelfCount =:= 0"},

system_profile.erl:58:<0.123.0>: Total: 338, For tracer: 0, For others: 338

  Failed: 1.  Skipped: 0.  Passed: 1.

My questions are: Am I using it wrong? If so, how should it be used? If
not, Is it a bug?

MVH Magnus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120103/55dbdefd/attachment.htm>

More information about the erlang-questions mailing list