On Fri, May 27, 2005 at 02:31:24PM -0700, Ira Woodhead wrote:
> 
> Hey all, 
> 
> I found in the list archives a suggestion to use prof or gprof to profile 
> inlined C code. But that doesn't seem to work. No gmon.out file is generated, 
> though I verified with nm that the mcount routine was inserted into the .so 
> file... Additionally there is no suggestion in the documentation of gprof or 
> prof on how to deal with profiling shared libraries rather than compiled 
> standalone programs... 
> 
> Is it possible I have to recompile perl itself with the -pg flag? That seems 
> absurd...

>From what I understand of how gprof works, you'd need to relink the main
program with the -pg flag too, as that's how it gets suitable at_exit()
routines to write out the profiling data.

I think that this is possible without recompiling all of the perl core,
given that perl installs a libperl.a containing all the perl core *.o files.

The easiest way is probably actually to build your extension as a static
extension, which MakeMaker supports, although it is not the default.
Offhand I can't remember how to coerce MakeMaker into making static
extensions, let alone how to parse that through via Inline. Hopefully the
MakeMaker docs are sufficient.

If all this is absurd, then it's absurdity due to gprof, not due to perl.

Nicholas Clark

Reply via email to