This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: gprof stats without clean exit -> how?
- From: Nick Clifton <nickc at cambridge dot redhat dot com>
- To: "Alan" <atk at arctic dot org>
- Cc: binutils at sources dot redhat dot com
- Date: 04 Dec 2001 09:15:14 +0000
- Subject: Re: gprof stats without clean exit -> how?
- References: <20011203171755.9615.qmail@twinlark.arctic.org>
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