[erlang-questions] How to profile a running erlang production server with fprof?

Kaiduan Xie <>
Fri Jan 30 16:12:56 CET 2009


Roux,

This is really helpful. I got fprof included in the release file, and fprof
was in the release. But I did not figure out how to profile the whole
system. The user guide just shows how to profile a particular function. I
tried fprof:trace(start), fprof:trace(stop), fprof:profile(),
fprof:analyse() without luck. The server is a call server and spawning many
processes.

Thanks again for the detailed explanation.

kaiduan

On Fri, Jan 30, 2009 at 6:25 AM, Roux Viljoen <
> wrote:

>  Kaiduan Xie <kaiduanx <at> gmail.com> writes:
>
> >
> > The production server is structured as an OTP application, and an Erlang
> shell is attached. How to profile the WHOLE system with fprof from the
> shell?
> Detailed command sequence  is highly appreciated.Thanks a lot for
> help,kaiduan
> >
>
>
> Kaiduan Xie,
>
> Fprof is part of the tools library found in OTP, so first you need to make
> sure
>  its loaded with your application by adding it to your release.
> Add this to the list of applications in the release file, just change the
> version to match yours:
> {tools, '2.6.2'}
>
> Now you can use the fprof application. There is alot of ways to use fprof,
> but
> the following should be fine. First start a trace by entering:
>
> fprof:trace([start, {file, "/home/kaiduanxie/first.trace"}, verbose,
> {procs,all}]).
>
> Now you can run whichever processes you want to profile and then when
> you're
> done, stop the trace by entering:
>
> fprof:trace([stop]).
>
> The trace file can now be profiled and analyzed:
>
> fprof:profile({file, "/home/kaiduanxie/first.trace"}).
> fprof:analyse([totals, {dest, "/home/kaiduanxie/first.analysis"}]).
>
> This will produce the first.analysis file which will contain all the data
> you want. Just be aware that fprof has many configuration options
> available,
> this was just a simplistic example.
>
> Also, in this example we used the {procs,all} option when we started the
> trace,
> this allowed fprof to trace ALL processes. This can cause the trace and
> analysis files to be huge if you're gonna run alot of processes, so just
> make
> sure you have enough disk space.
>
> Please consult the documentation for the configuration options if this
> example
> does not produce the desired results.
>
> Good luck,
>
>
> Roux Viljoen
> Erlang Training & Consulting
> http://www.erlang-consulting.com
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090130/49acc918/attachment.html>


More information about the erlang-questions mailing list