Profiling

From Notes_Wiki
Revision as of 01:26, 8 February 2014 by Saurabh (talk | contribs)

<yambe:breadcrumb>Erlang|Erlang</yambe:breadcrumb>

Profiling

Function call time profiling

To profile Erlang programs for function call time use:

1> fproc:apply(fun mod:name/arity, [Args]).
2> fproc:profile().
3> fproc:analyse().

This is useful for sequential programs so that time taken by each function can be compared.


Concurrency profiling

To profile Erlang programs for concurrency use:

1> percept:profile("test.dat", {Mod, Fun, Args_list}, [procs]).
2> percept:analyze("test.dat").
3> percept:start_webserver(8888).

and then open http://localhost:8888/ to see the concurrency profile with number of processes spawned and runnable time for each process. For more information refer to percept app tutorial at http://www.erlang.org/doc/apps/percept/percept.pdf


Use "erl -man fprof" and see analysis example at end of man page for more details.