Instead, I wanted to see if I can find a profiler that would stop my
app once in a while, examine stack, and continue to run immediately
after taking a call stack snapshot. After getting so many stack
snapshots, I would be able to get some idea of where time is spent.
Is there something like that for Linux?
(Ubuntu Jaunty in my case).
thanks
i
This profiling technique is called sampling and oprofile does that.
SunStudio for Linux (and Solaris) also does that.
--
Max
> Is there something like that for Linux?
Have you tried valgrind?
Markus
If the performance with gprof is an issue, valgrind isn't really an
alternative.
It may be easier than you think to roll your own programmatically by
setting up an asynchronous periodic signal interrupt, and within the
signal handler calling the glibc 'backtrace' call.
In the glibc manual see "Signal Handling" and "Backtraces":
http://www.gnu.org/s/libc/manual/html_node/Signal-Handling.html
http://www.gnu.org/s/libc/manual/html_node/Backtraces.html
Enjoy,
Andrew.
--
Andrew Tomazos <and...@tomazos.com> <http://www.tomazos.com>
Running code compiled with -pg for gprof *does* slow it down, but try
it before you reject the idea.
It does not "involve a lot of output" -- as far as I can tell it
stores statistics in a memory area proportional to the number of
functions or calls in your program. A file is written, but not until
your program exits.
/Jorgen
--
// Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
\X/ snipabacken.se> R'lyeh wgah'nagl fhtagn!