[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
**Subject**: **Accumulating time from called functions in a profiler**
**From**: Geoff Leyland <geoff_leyland@...>
**Date**: Tue, 3 May 2011 10:31:55 +1200

Hi,
Has anyone got any insight into a correct (or good) way to accumulate child time from called functions in a line-by-line profiler when there are recursive function calls?
I've looked at the source of other lua profilers, and I've read the gprof docs and so far all I've learned is that I don't know much.
For an example of what I'm talking about, consider the following:
function a(n)
wait(10)
if n > 0 then
a(n-1)
end
end
a(1)
If only the line wait(10) takes any time (10 time units), then should the child time for the *line* a(n-1) be 10 or 0?
Cheers,
Geoff
[1] http://docs.freebsd.org/44doc/psd/18.gprof/paper.pdf