Re: hi-res profiling

From: Robert Collins <robertc@dont-contact.us>
Date: 02 Oct 2002 17:41:32 +1000

On Wed, 2002-10-02 at 17:26, Henrik Nordstrom wrote:

> A more interesting example is
>
> foo (int n)
> {
> PROF_START (foo);
> if (n)
> foo (--n):
> // do some time consuming task
> PROF_STOP (foo);
> }
>
> but I am not sure we have many of these conditions..

Yes, was just poking for holes on the fly.
 
> >From reading the source it seems nesting is not supported very well
> within the same performance counter. If you do the readings will be
> somewhat screwed up usually giving more time spent in the counter
> than actual, counting the time from last start to each stop.
>
> Extending it to support nesting would not be too hard, but involves
> overhead so counters needing nesting should perhaps use other calls.
> Knowing which sections need nesting is not too hard. For such
> counters I propose measuring the time from first start to last stop.

I came to the same conclusion from the source, and am glad to have it
confirmed. For now, I agree with you on the timing of such recursion.
I'm actually concerned about a much more complex case:
something () {
  call cb function.
}

callback() {
}

where the callback occurs for a different instance of something(). We
need to be very sure to PROF_STOP (something) before calling out of it
IMO.
 
> Some suggestions for optimizations:

Thanks - I'll do a few of these.

Whats your take on putting this in HEAD? It's quite non intrusive, and
could be of assistance with various developments.. like commloops and
ESI.

Rob

Received on Wed Oct 02 2002 - 01:41:03 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:16:51 MST