This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: profiling API?


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]