|
|
| Author |
Message |
< Erlang ~ fprof exhausting my memory for smallish tests |
| Bill M. |
Posted: Sat Jul 19, 2008 10:48 am |
|
|
|
User
Joined: 06 Jun 2008
Posts: 24
Location: New York
|
Hello All:
I'm trying to profile a modest sized piece of code (about 1k lines total) that is compute intensive. I am using a function,
test/1 that takes the number of trials (for timing and correctness testing) as its sole argument. I then wrapped it with a function, fproftest/1 that fires up fprof and invokes test/1.
Code:
fproftest(NumTrials)->
fprof:apply(cramershoup, test, [NumTrials]),
FileName="/tmp/fprof.trace",
fprof:profile([{file, FileName}]),
fprof:analyse([{file, FileName}]).
However I'm running out of memory when I do this, however, running the software without fprof is fast and does not use very much memory at all (it runs in about 15 seconds).
My questions are:
1) I would like function time statistics and (if possible) invocation counts. I've searched for profiling documentation which mentions eprof, cprof and cover at
http://www.erlang.org/doc/efficiency_guide/profiling.html.
On a side note, the documentation of how to invoke the profilers is sparse for people new to Erlang, people should be given examples of how to run each profiler.
2) Is the excessive memory usage problem because of user error?
3) If I haven't made a user error, can someone explain a bit about how fprof works under the hood and why it would use so much memory? I've used many profilers before and most of them use a histogram data structure to accumulate statistics, which would not account for the amount of memory usage I'm seeing here. Maybe there is something about functional programming/Erlang that I don't understand yet, but would module:functionname/arity and line number should uniquely identify which "clause" is matched, which could be used to index into a histogram structure for maintaining counts?
Regards:
Bill M. |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|