DrWhy has asked for the wisdom of the Perl Monks concerning the following question:

I enter with some trepidation my first question to the monks...

I've been trying to profile a subroutine that needs to work faster using perl -d:DProf and dprofpp. The code I'm testing is embedded in a good bit of other code (mostly setting up the environment for the test code) so I would like to use the -g option of dprofpp to look only at the data for the relevant sub and the things it calls.

I'm running into a brick wall. It looks like it just doesn't work. I get the following:

> /usr/local/bin/dprofpp -g base::import tmon.out Modification of non-creatable array value attempted, subscript -1 at / +usr/local/stow/perl-debug5.6.1/bin/dprofpp line 584, <fh> line 210.

I'm using Perl 5.6.1 on a Solaris system and the Devel::DProf and dprofpp that comes with it.

I've tried a build of perl with and without -DDEBUGGING and that only seems to change the line number in the error message above.

Having looked around on PM and on the Web I've found nothing, but a couple of other mentions of the problem with no solution.

So my question is: Have any of you ever successfully used the -g option of dprofpp? If you have can you tell me a little about the environment you were in, e.g. perl version, os, a little of the circumstances of your testing, anything you think might be helpful to me getting it to work.

Thanks.

Replies are listed 'Best First'.
Re: dprofpp -g doesn't work for me
by BrowserUk (Patriarch) on Jan 07, 2004 at 05:35 UTC

    This is using AS 5.6.1 on NT4.

    C:\test>dprofpp -g Date::Manip::ParseDate Total Elapsed Time = -0.00257 Seconds User+System Time = 0.127452 Seconds Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name 23.5 0.030 0.059 2 0.0150 0.0297 Date::Manip::ParseDateStr +ing 15.6 0.020 0.020 2 0.0100 0.0100 Date::Manip::Date_Regexp 15.6 0.020 0.020 18 0.0011 0.0011 Date::Manip::IsInt 15.6 0.020 0.020 2 0.0100 0.0100 Date::Manip::ParseDateDel +ta 14.9 0.019 0.078 2 0.0097 0.0389 Date::Manip::Date_Init 7.85 0.010 0.010 2 0.0050 0.0049 Date::Manip::CheckFilePat +h 7.85 0.010 0.020 1 0.0100 0.0198 Date::Manip::FixPath 0.00 0.000 0.127 2 0.0000 0.0637 Date::Manip::ParseDate 0.00 0.000 0.020 1 0.0000 0.0196 Date::Manip::SearchPath 0.00 0.000 -0.000 3 0.0000 - Date::Manip::FullFilePath 0.00 0.000 -0.000 3 0.0000 - Date::Manip::ExpandTilde 0.00 0.000 -0.000 3 0.0000 - Date::Manip::CleanFile 0.00 0.000 -0.000 1 0.0000 - Date::Manip::Date_Init_En +glish 0.00 0.000 -0.000 4 0.0000 - Date::Manip::Date_InitLis +ts 0.00 0.000 -0.000 25 0.0000 - Date::Manip::Date_InitStr +ings

    You do need to specify the exact name of the subroutine, including its package and case sensitively. It seems to work ok.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Hooray!

      Thanks for the input.

      Okay, so the thing isn't completely hosed for everyone. Can you do me a favor and look at (grep) the tmon.out file that was used to produce your example output and see if there were any lines that are an asterisk followed by a hexadecimal number (e.g. '* 2b'). These are the lines that are causing my setup to crash. If I change them to, e.g. "+ 2b" (for which '* 2b' appears to be a variation of some kind) the trouble goes away -- of course, I'm not sure I'm getting accurate results this way.

      Update: changing all the '* xNUM' lines in the tmon.out to '+ xNUM' does still give me the correct (or at least the same) output. However you have to use the -F switch because it confuses dprofpp about exits from the relevent subroutines calls. I guess this workaround will work sufficiently for my purposes.

        No. There were no "* xx" lines in tmon.out, so I added one and got

        C:\test>dprofpp -g Date::Manip::ParseDate Modification of non-creatable array value attempted, subscript -1 at d +:\perl\bin/dprofpp.bat line 692, <fh> line 664.

        Looking at the POD for Dprof, there is this line

        Lines starting with +, - and * mark entering and exit of subroutines by ids, and goto &subr.

        Which I interpret to mean that lines starting with * indicate a trnasfere of control using goto &subr. A curosry grep through the sources of the modules (strict, Date::Manip etc.) that are used by the test program didn't turn up any gotos.

        I think you have the source of the problem. You could try replace each occurance of "* xx" with

        + xx - xx

        which should amount to the same thing, but you would need to consult the author/maintainer for a confirmation (and fix). HTH.


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "Think for yourself!" - Abigail
        Hooray!

Re: dprofpp -g doesn't work for me
by Anonymous Monk on Jan 07, 2004 at 07:31 UTC
    What version? Try upgrading