This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: profiling API?
- From: James Cownie <jcownie at etnus dot com>
- To: William Brodie-Tyrrell <william at cs dot adelaide dot edu dot au>
- Cc: binutils at sources dot redhat dot com
- Date: Fri, 14 Mar 2003 11:16:26 +0000
- Subject: Re: profiling API?
- Reply-to: James Cownie <jcownie at etnus dot com>
> I'd like to profile small(ish) portions of the execution of a
> program rather than the whole thing as it has a few behaviour phase
> changes and I want to profile one mode.
I think what you're looking for is
moncontrol (int on);
By using this you can compile your code with profiling everywhere; in
main do moncontrol(0); to turn profiling off, then in the section of
interest use moncontrol (1); to turn profiling on.
If you want to profile different chunks (for instance a startup
separately from a stable iteration) you may need to run multiple
experiments (or else use the reset and dump trick which was shown here
previously).
HTH
Of course you need to be aware that gprof _only_ profiles the
executable. (So if you're spending all your time in strcmp() beware).
What we really need to overcome that is an implementation of something
like SGI's sprofil which allows you to collect profil counts for
disjoint text spaces.
-- Jim
James Cownie <jcownie at etnus dot com>
Etnus, LLC. +44 117 9071438
http://www.etnus.com