How can I profile a linked-in port driver? OTP tools (fprof
, etc.) apparently only profile Erlang code, and I don't have a C executable file to feed to gprof
.
Asked
Active
Viewed 343 times
2

Alexey Romanov
- 167,066
- 35
- 309
- 487
-
1Get it running exercising your driver, flat out. Then take some stackshots (like 10) using **lsstack** or **pstack**. That should show, as percents, how the time is spent. For overall speed, you can just use the run-it-1000-times method. – Mike Dunlavey Nov 12 '10 at 17:40
2 Answers
3
Can't you just profile the erl
executable and then get that to the gprof
tool? I am pretty sure this is how it is done by the Erlang devs anyway.

I GIVE CRAP ANSWERS
- 18,739
- 3
- 42
- 47
-
It would be nice to avoid rebuilding OTP, if possible. Of course, other profilers than `gprof` may not require it... – Alexey Romanov Nov 12 '10 at 17:53
2
as far as linked-in port driver is .so library that is dynamically loaded into erl process (on linux) you can run valgrind --tool=callgrind --callgrind-out-file=file.out erl (see other options in docs for callgrind), then execute some tests from erl shell, exit from shell and load file.out in some tool like KCachegrind

adolgarev
- 188
- 1
- 9