in reply to Re: Profiling the C side of an Inline::C module
in thread Profiling the C side of an Inline::C module

Compiling the module with "-pg" and linking in the profiling lib are no problem... But that doesn't seem to do it. gprof wants to work on "a.out", which I guess would be /usr/bin/perl in this case. I'd be willing to recompile Perl if that would do it, but I'd like to hear that someone has done it successfully before first. My programmer's intuition is telling me it won't work...

-sam

  • Comment on Re^2: Profiling the C side of an Inline::C module

Replies are listed 'Best First'.
Re^3: Profiling the C side of an Inline::C module
by Anonymous Monk on Sep 05, 2005 at 00:33 UTC
    I'd be willing to recompile Perl if that would do it, but I'd like to hear that someone has done it successfully before first. My programmer's intuition is telling me it won't work...
    Alright, I've never done that exact thing (I've done debugging of Inline C code with gdb and a perl with debugging symbols, though), but I'd be extremely surprised if the combination of compiling perl and your inline c code with '-pg' didn't work correctly. What exactly about your intuitions tells you it won't?
      The 'gprof' program wants to look at 'a.out' to interpret the contents of the generated 'gmon.out'. Assuming 'a.out' is a specially-prepared Perl, I don't see how it could have the data needed to interpret calls to my module's code. I could be wrong though, I'm just going by what I've read of the manual.

      -sam

        Wouldn't it only take about 20 minutes to compile a new version of perl and find out? (Are you mostly familiar with Windows perchance?)
Re^3: Profiling the C side of an Inline::C module
by fizbin (Chaplain) on Sep 05, 2005 at 21:20 UTC
    Well, my intuition is telling me it will work, if you compile perl with the -pg option, and arrange for the final invocation of ld to use the profiling C runtime. You should end up with a perl that, when run (e.g. with perl -e 1), produces a gmon.out file.

    Then, make sure that Inline::C is using the -pg option to compile your module, and when you run perl on your test script, you'll now get a gmon.out file that includes profiling details about your module.

    --
    @/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/
      Alright, I'll give it a try. I was won over when I found in reading perlhack that Perl has built-in support for gprof via the "perl.gprof" make target.

      -sam

        So, did it ever get it to work? If so, can you post a little bit of your recipe? If not, can you enlighten us as to where the process crapped out?