octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave profiler,


From: John W. Eaton
Subject: Re: Octave profiler,
Date: Mon, 29 Jan 2007 16:31:28 -0500

On 29-Jan-2007, David Bateman wrote:

| Not bad, but is this really the best place for the hooks to the
| profiler? I'd have thought in the parser was better, though I don't know
| where exactly to include the hooks as I'm not a YACC expert.. Doing it
| in the parser would allow easier inclusion of code to get finer grained
| profiling... I believe with the hook in the right place in the parser,
| most of your existing code could easily be transitioned there without
| much effort..

It wouldn't make sense to call these from the parser itself, since
that code only runs when the functions are read.  You want to call
them from the evaluator code.  So you need to look at the pt-X files
and also some of the ov-X files.  All the classes that make up part of
the parse tree are listed in pt-walk.h

One possibility is to hook the profiler directly in to the eval,
rvalue, etc. functions that are used to evaluate elements of the
parse tree.  But then there could be a slight performance hit even
when we are not doing profiling (all the eval functions have to check
to see whether they should do the things necessary for profiling).

Another possibility is to write a profiling evaluator as a visitor
class that works using the tree_walker structure.  It might actually
be a useful experiment to see how hard it is to write an evaluator
using this structure.  If it works and can be done with a minimal
impact on performance, it would probably be better to have the
evaluator written this way.  Then I think you might be able to write
the profiling evaluator by deriving from the normal evaluator.  Then
adding the profiling code to the interpreter would have no impact on
the performance of the normal evaluator.

If this is possible, then a debugginng evaluator could be written the
same way.  Instead, it is currently hooked in to the eval functions of
the evaluator.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]