[Sorry for this resend . I noticed that Netscape mailer
formatted my previous message to be almost unreadable.]
Fellow *.oct users/developers:
In short form: does anyone know how to interactively
profile (e.g. gprof) .oct code (e.g. some sort of
reset/start/stop/dump functionality) from the Octave prompt?!
In longer form:
Compiling,/loading/reloading *.oct dynamic files is working
GREAT for me (Octave 2.0.11, Solaris 2.5.). Using MATWRAP, I've
been quickly building nice C++ libs that are easily accessible
from both OCTAVE (oct) and MATLAB (mex). [If you haven't
checked out MATWRAP (http://www.klab.caltech.edu/~holt/matwrap/)
yet, you're really missing out!] It's really all quite nice ...
(much thanks to both John Eaton and Gary Holt!!...)
HOWEVER, I really want to use profiling tools such as gprof
to help me find bottlenecks in my oct code. As you can imagine,
compiling the oct files with gprof prep flags to CC (e.g. -pg)
does not directly work, since that seems to assume that you are
compiling the main() as well (which is the Octave main() here),
and it doesn't dump the gprof stats (e.g. gmon.out file) until
_exit() is called. Compiling my oct files into new Octave
statics (e.g. recompiling Octave to include my oct code) isn't
an acceptable solution, since I REALLY want to start, stop, and
examine profiling data interactively ...
What I want, and am guessing some has already done by now, is
some simple *.oct wrapper code to access some START, STOP, and
DUMP functionality to some good profiler package, such as gprof.
In lieu of that, I need pointers to the right profiler (or
documentation) so that I can develop these functions myself.
Of course, this is essentially a general question, which applies
to profiling MATLAB mex files and general dynamic loading
libaries (like Solaris *.so files). But I haven't found anyone
who's actually done such a thing in any context, and I've
checked the obvious spots, such as the dejanews archives and
gprof mans. I'm hoping and thinking that, once again, the
Octave community is more likely to be pushing the envelope! ...
Thanks for any advice or pointers. If I can figure out a
workable approach here, I will happily develop and contribute
C/OCT code for the desired functions (e.g. gprof_start.m,
gprof_stop.m, gprof_dump.m, gprof_reset.m), as well as any
needed patches to mkoctfile to enable oct file compilation that
supports this (e.g. a "-gprof" flag to mkoctfile).
Technical note: I *have* tried to use the (Solaris specific?)
man3c/monitor interface to profil. My attempts to call monitor()
with proper args (e.g. PC numbers based on _end) have failed to
date. Tips/warnings on whether that approach is doable or a
too-complex/wrong route would also be useful ...
| In short form: does anyone know how to interactively
| profile (e.g. gprof) .oct code (e.g. some sort of
| reset/start/stop/dump functionality) from the Octave prompt?!
I'm afraid I don't know enough about the details of how profiling
works to say how to do what you want. It would be a nice addition to
Octave though, so if anyone has any ideas, please send them my way.