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

Fellow Monks,

while in the process of cleaning some code, I think I might gain advantage of Devel::Smallprof, but this seems not to be compatible with my installed version of the language (Activestate 5.8 on a Win2k box).

Apart for reinstalling 5.6 (declared compatible), or using Benchmark on selected portions of the code, is there any option you might suggest?

Perl vobiscum
ric

Replies are listed 'Best First'.
Re: A substitute for Devel::Smallprof?
by rinceWind (Monsignor) on May 14, 2003 at 17:33 UTC
    I guess you are referring to the bug reported on RT relating to building Devel::Smallprof on 5.8.0.

    I'm curious. Do others running 5.8.0 get the same error? Have you tried contacting the author of the module?

    I'm still running 5.6.1 in most places, so have not encountered the problem.

Re: A substitute for Devel::Smallprof?
by BrowserUk (Patriarch) on May 15, 2003 at 05:24 UTC

    USEFULE UPDATE:) Ignore all the stuff below and add the following line just above the use Time::HiRes 'time'; at line 9 of SmallProf.pm.

    sub DB{ return; }

    This satsfies the error created when the debugger tries to invoke DB::DB() as Time::HiRes is loaded at BEGIN time, which is before the DB::DB() sub has been compiled. If you enable warnings via the command line with -w, you will see the error msg

    Subroutine DB redefined at D:/Perl/lib/Devel/SmallProf.pm line 50.

    When the above benign routine is replaced by the real one. Other than that, this fix seems to be completely effective and transparent.

    END UPDATE - Everything below is redundant

    I'm not sure that this a complete answer, but I found that if you comment out the use Time::HiRes 'time'; at line 4 9 of SmallProf.pm, the profiling completes without error.

    The problem then is, that the wallclock times are then calculated using the built-in time function (with it's inherent limitation of whole second resolution) rather than the Time::HiRes equivalent with its sub-second resolution.

    This renders the wallclock timimgs pretty useless unless you have really long running processes, but the iteration counts and cpu second times remain unaffected. As these are, for the most part, the most useful figures, it may at least allow you to continue until the p5p guys resolve the problem properly.

    I tried moving the use line around various places, but it seems to be some weird sort of circular dependancy that is tripping it up. Anyway, maybe this will help you some.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
New version 1.11 in CPAN (Re: A substitute for Devel::Smallprof?)
by ric (Scribe) on May 20, 2003 at 18:13 UTC
    Just noticed a recent (May 19th) and updated version in CPAN (1.11 vs. 0.9), compatible with Perl5.

    Perl vobiscum
    ric