On Mon, Dec 17, 2007, Amos Jeffries wrote:

> this?
> http://wiki.squid-cache.org/LinuxOprofile

Yup.

> > I've been meaning to write a shim or two to overload the -pg feature in
> > GCC -
> > it'll call your function enter/exit stubs with some stack information -
> > so I can generate call graphs inside Squid without having to do the
> > inaccurate
> > gprof time profiling.
> 
> That went right over my head, all but the 'expensive ... time profiling'
> which kind of sticks to something from wayback.

Well, gprof gives you two things - time spent in routines and callgraphs/call 
counts.
The time spent in routines isn't accurate at all nowdays, the sampling is 
intrusive
and not fast enough (it can only run as fast as the system timer allows.)

There's a flag to gcc which generates stubs calling these:

       -finstrument-functions
           Generate instrumentation calls for entry and exit to functions.  
Just after function entry and just before
           function exit, the following profiling functions will be called with 
the address of the current function and
           its call site.  (On some platforms, "__builtin_return_address" does 
not work beyond the current function, so
           the call site information may not be available to the profiling 
functions otherwise.)

So what I'd like to do is implement my own call graphing stuff and use the 
system
performance counters to grab execution profiles.

(But thats a side project. Unrelated to this. :)




Adrian

Reply via email to