gprof stats without clean exit -> how?

Nick Clifton nickc@cambridge.redhat.com
Tue Dec 4 01:18:00 GMT 2001


Hi Alan,

> Is it possible to obtain a "current" gprof stats on a program
> without having the program do a clean exit -- i.e.,
> 
> -> dump stats
> -> abort()
> 
> sequence ?

It depends upon the particular implementation of the profiling library
functions.  For a C program they typically use atexit() to register a
dump-the-stats-and-tidy-up function, so you could arrange for you
program to call this function directly at the point where you want the
stats generated.  A C++ implementation will probably use a global
constructor/destructor so you would need to find a way to invoke the
destructor directly.

Cheers
        Nick



More information about the Binutils mailing list