Difference between revisions of "Profiling"

From Notes_Wiki
(Created page with "<yambe:breadcrumb>Erlang|Erlang</yambe:breadcrumb> =Profiling= To profile Erlang programs use: <pre> 1> fprof:apply(fun mod:name/arity, [Args]). 2> fprof:profile(). 3> fprof:...")
 
m
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<yambe:breadcrumb>Erlang|Erlang</yambe:breadcrumb>
[[Main_Page|Home]] > [[Erlang]] > [[Profiling]]
=Profiling=


To profile Erlang programs use:
==Function call time profiling==
To profile Erlang programs for function call time use:
<pre>
<pre>
1> fprof:apply(fun mod:name/arity, [Args]).
1> fprof:apply(fun mod:name/arity, [Args]).
Line 8: Line 8:
3> fprof:analyse().
3> fprof:analyse().
</pre>
</pre>
 
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:
<pre>
1> percept:profile("test.dat", {Mod, Fun, Args_list}, [procs]).
2> percept:analyze("test.dat").
3> percept:start_webserver(8888).
</pre>
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 "<tt>erl -man fprof</tt>" and see analysis example at end of man page for more details.
Use "<tt>erl -man fprof</tt>" and see analysis example at end of man page for more details.
[[Main_Page|Home]] > [[Erlang]] > [[Profiling]]

Latest revision as of 13:45, 7 April 2022

Home > Erlang > Profiling

Function call time profiling

To profile Erlang programs for function call time use:

1> fprof:apply(fun mod:name/arity, [Args]).
2> fprof:profile().
3> fprof: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.


Home > Erlang > Profiling