[erlang-questions] How to use dbg and fprof to profile a running server ?

Bo Chen <>
Tue Aug 28 11:17:29 CEST 2012


Hello, every one,
            I am a rookie in erlang. Recently I am trying to use the dbg
and fprof module to profile a running server to observe the performance.
Since the server is based on mochiweb, a quite popular web server
framework, and I only wish to see the performance of my own code, I tried
the dbg module. I have tried in the following two ways:

1: use dbg to write trace to file and use fprof to analyse the result
dbg:stop_clear(),
dbg:tracer(port,dbg:trace_port(file,"fprof.trace")),
dbg:tpl(util,[]),
dbg:tpl(...),
dbg:p(all,[call,return_to, procs, timestamp,running,garbage_collection]),
dbg:stop_clear(),
fprof:profile(),
Fname = lists:append("profile/",Name),
fprof:analyse({dest, Fname}).

2: like fprof, but use dbg:tpl to confine the module
fprof:trace([start, {procs, all}]),
dbg:tpl(util,[]),
dbg:tpl(...),
fprof:trace([stop]),
fprof:profile(),
Fname = lists:append("profile/",Name),
fprof:analyse({dest, Fname}).

Sadly, neither way seems to work.

So any idea about how to combine the dbg and fprof module?
Or maybe someone would like to point out the mistake I have made?

Thanks in advance for your reply~

-- 
   陈波 / Bill
   2009级本科生
   清华大学软件学院
------------------------------------------------------------
   Chen Bo
   School of Software
   Tsinghua University
   Add: Building Zijing 1# Room 210B,
           Tsinghua University Beijing 100084
           P.R.CHINA
   Tel:  +86-010-51534210
   E-mail: 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120828/6025ef1c/attachment.html>


More information about the erlang-questions mailing list