Tools for Profiling Erlang Code
The standard Erlang distribution comes with three profiling tools.
-
cprofcounts the number of times each function is called. This is a lightweight profiler. Running this on a live system adds from 5 to 10 percent to the system load. -
fprofdisplays the time for calling and called functions. Output is to a file. This is suitable for large system profiling in a lab or simulated system. It adds significant load to the system. -
eprofmeasures how time is used in Erlang programs. This is a predecessor offprof, which is suitable for small-scale profiling.
Here’s how you run cprof; we’ll use it to profile the
code that we wrote in A SHOUTcast Server:
| | 1> cprof:start(). %% start the profiler |
| | 4501 |
| | 2> shout:start(). ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access