This is the mail archive of the
guile@sources.redhat.com
mailing list for the Guile project.
Re: Scheme profiler?
Mikael Djurfeldt <mdj@mdj.nada.kth.se> writes:
> > > Is there any Scheme code profiler that works with Guile?
> > > It seems Guile's core (libguile/eval.c) has no such code in it.
> > > Is it a good idea to work on this? (I guess the debug evaluator
> > > may have such facilities...)
> >
> > This is actually fairly easy. Even the patch below gives some
> > useful information:
>
> Interesting idea. But we should use the already existing hooks.
> There is something called the `apply-frame-handler' which is called
> if you do
>
> (trap-enable 'apply-frame)
>
> 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.
Thanks,
Keisuke Nishida