This is the mail archive of the
mailing list for the Guile project.
Re: Scheme profiler?
Keisuke Nishida <email@example.com> writes:
> Mikael Djurfeldt <firstname.lastname@example.org> writes:
> > The same handler is called also if you do (debug-enable 'trace).
> > Look at the implementation of `trace' in (ice-9 debug) to see how to
> > use the handler.
> Yes, I noticed it and tried to reimplement a profiler by using it,
> but I realized that it might be hard. Since apply-frame-handler can
> be called several times for each procedure call if the procedure is
> recursive, recording the time for such a procedure could be tricky.
> I thought adding an additional debug option could be helpful. (I
> don't remember the reason exactly.)
> BHW, there is another hook called enter-frame-handler. When is it
> called? When I tried using it, it was never called. If enter-frame-
> hander and exit-frame-handler is called in pair, it will help me.
Yes. I'd think that's exactly what you'd need. The entry only hook
is insufficient. To do it right you need to stack up the start times
on each fcn entry and pop them on fcn returns. Aside from call/cc
that should cover everything. Actually, I think it'd work for call/cc
too, but you'd have to make sure. Another wrinkle is accounting for