public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: profiling API?
@ 2003-03-14 11:16 James Cownie
  2003-03-16 23:30 ` William Brodie-Tyrrell
  0 siblings, 1 reply; 7+ messages in thread
From: James Cownie @ 2003-03-14 11:16 UTC (permalink / raw)
  To: William Brodie-Tyrrell; +Cc: binutils


> 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@etnus.com>
Etnus, LLC.     +44 117 9071438
http://www.etnus.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: profiling API?
  2003-03-14 11:16 profiling API? James Cownie
@ 2003-03-16 23:30 ` William Brodie-Tyrrell
  0 siblings, 0 replies; 7+ messages in thread
From: William Brodie-Tyrrell @ 2003-03-16 23:30 UTC (permalink / raw)
  To: James Cownie; +Cc: binutils


Stoned koalas drooled eucalyptus spit in awe as James Cownie declaimed:

> > 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);

yes!  that's exactly what I'm looking for, thankyou.  It appears to be
missing from sys/gmon.h (only has [__]monstartup, _mcleanup), but objdump
shows it to be exported from libc.


thanks muchly :)

William Brodie-Tyrrell

-- 
I wouldn't eat dolphin.  I refuse to eat anything smarter than me.
Which is why I abstain from broccoli.
	-- <jre>

<william@cs.adelaide.edu.au>
http://www.cs.adelaide.edu.au/~william
Room 3034, Plaza Building



^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: profiling API?
  2003-03-13 23:17   ` William Brodie-Tyrrell
@ 2003-03-14 11:26     ` Rob Taylor
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Taylor @ 2003-03-14 11:26 UTC (permalink / raw)
  To: William Brodie-Tyrrell, Nick Clifton; +Cc: binutils, gcc

try
http://sourceforge.net/projects/fnccheck/

*may* need some work to work with 3.x, but let me know if you can get it
working!!

Rob Taylor          mailto:robt@flyingpig.com
Flying Pig Systems  http://www.flyingpig.com
Tel:                +44 20 8280 9230


> -----Original Message-----
> From: gcc-owner@gcc.gnu.org [mailto:gcc-owner@gcc.gnu.org]On Behalf Of
> William Brodie-Tyrrell
> Sent: 13 March 2003 23:17
> To: Nick Clifton
> Cc: binutils@sources.redhat.com; gcc@gnu.org
> Subject: Re: profiling API?
>
>
>
> Stoned koalas drooled eucalyptus spit in awe as Nick Clifton declaimed:
>
> > > Is there any way to get multiple gmon.out files for a given
> > > execution?
> >
> > No. :-(
>
> oh well.
>
> > You can compile only certain files with profiling enabled.  That way
> > you will only generate profile information for the functions in those
> > files, (plus any functions that they call...)
>
> yep, been doing that.  What I'd hoped for was to divide the results up by
> time.
>
> > You might also consider using the -finstrument-functions command line
> > switch and writing your own profiling tools.
>
> haha.  surely you jest :)   I'm having a bad enough time getting the code
> I *need* done in time :(
>
>
> thanks for the help, anyway.
>
> William Brodie-Tyrrell
>
> --
> I wouldn't eat dolphin.  I refuse to eat anything smarter than me.
> Which is why I abstain from broccoli.
> 	-- <jre>
>
> <william@cs.adelaide.edu.au>
> http://www.cs.adelaide.edu.au/~william
> Room 3034, Plaza Building
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: profiling API?
  2003-03-13 17:49 ` Nick Clifton
  2003-03-13 20:28   ` Frank Ch. Eigler
@ 2003-03-13 23:17   ` William Brodie-Tyrrell
  2003-03-14 11:26     ` Rob Taylor
  1 sibling, 1 reply; 7+ messages in thread
From: William Brodie-Tyrrell @ 2003-03-13 23:17 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils, gcc


Stoned koalas drooled eucalyptus spit in awe as Nick Clifton declaimed:

> > Is there any way to get multiple gmon.out files for a given
> > execution?
>
> No. :-(

oh well.

> You can compile only certain files with profiling enabled.  That way
> you will only generate profile information for the functions in those
> files, (plus any functions that they call...)

yep, been doing that.  What I'd hoped for was to divide the results up by
time.

> You might also consider using the -finstrument-functions command line
> switch and writing your own profiling tools.

haha.  surely you jest :)   I'm having a bad enough time getting the code
I *need* done in time :(


thanks for the help, anyway.

William Brodie-Tyrrell

-- 
I wouldn't eat dolphin.  I refuse to eat anything smarter than me.
Which is why I abstain from broccoli.
	-- <jre>

<william@cs.adelaide.edu.au>
http://www.cs.adelaide.edu.au/~william
Room 3034, Plaza Building


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: profiling API?
  2003-03-13 17:49 ` Nick Clifton
@ 2003-03-13 20:28   ` Frank Ch. Eigler
  2003-03-13 23:17   ` William Brodie-Tyrrell
  1 sibling, 0 replies; 7+ messages in thread
From: Frank Ch. Eigler @ 2003-03-13 20:28 UTC (permalink / raw)
  To: Nick Clifton; +Cc: William Brodie-Tyrrell, binutils, gcc


nickc wrote:

> > 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.
> > 
> > Is there any way to get multiple gmon.out files for a given
> > execution?
> 
> No. :-(
> [...]

Depending on the details of your particular gprof runtime, a program
might be able to call a sequence like the following to get multiple
cumulative profile snapshots:

     _mcleanup ();  /* suspend profiling, write gmon.out */
     rename ("gmon.out", "gmon.out.NNN" );
     moncontrol (1); /* resume profiling */

- FChE

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: profiling API?
  2003-03-04  5:45 William Brodie-Tyrrell
@ 2003-03-13 17:49 ` Nick Clifton
  2003-03-13 20:28   ` Frank Ch. Eigler
  2003-03-13 23:17   ` William Brodie-Tyrrell
  0 siblings, 2 replies; 7+ messages in thread
From: Nick Clifton @ 2003-03-13 17:49 UTC (permalink / raw)
  To: William Brodie-Tyrrell; +Cc: binutils, gcc

Hi William,

> 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.
> 
> Is there any way to get multiple gmon.out files for a given
> execution?

No. :-(

> Being able to get the output at arbitrary times (eg on
> receipt of a signal) would be sufficient, but it would be even
> better if the program could control its own profiling.

You can compile only certain files with profiling enabled.  That way
you will only generate profile information for the functions in those
files, (plus any functions that they call...)

You might also consider using the -finstrument-functions command line
switch and writing your own profiling tools.

Cheers
        Nick

^ permalink raw reply	[flat|nested] 7+ messages in thread

* profiling API?
@ 2003-03-04  5:45 William Brodie-Tyrrell
  2003-03-13 17:49 ` Nick Clifton
  0 siblings, 1 reply; 7+ messages in thread
From: William Brodie-Tyrrell @ 2003-03-04  5:45 UTC (permalink / raw)
  To: binutils, gcc


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.

Is there any way to get multiple gmon.out files for a given execution?
Being able to get the output at arbitrary times (eg on receipt of a
signal) would be sufficient, but it would be even better if the program
could control its own profiling.



PS: I'm not subscribed to the binutils mailing list, so please include me
in any replies.

William Brodie-Tyrrell

-- 
I wouldn't eat dolphin.  I refuse to eat anything smarter than me.
Which is why I abstain from broccoli.
	-- <jre>

<william@cs.adelaide.edu.au>
http://www.cs.adelaide.edu.au/~william
Room 3034, Plaza Building


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-03-16 23:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-14 11:16 profiling API? James Cownie
2003-03-16 23:30 ` William Brodie-Tyrrell
  -- strict thread matches above, loose matches on Subject: below --
2003-03-04  5:45 William Brodie-Tyrrell
2003-03-13 17:49 ` Nick Clifton
2003-03-13 20:28   ` Frank Ch. Eigler
2003-03-13 23:17   ` William Brodie-Tyrrell
2003-03-14 11:26     ` Rob Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).