This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Scheme profiler?


Keisuke Nishida <kxn30@po.cwru.edu> writes:

 > Mikael Djurfeldt <mdj@mdj.nada.kth.se> 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
anonymous fcns.

-- 
Harvey Stein
Bloomberg LP
hjstein@bfr.co.il

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]