in reply to Dreaming of a Better Profiler

These samples are used to construct a profile of the activity of the process. It's not a "perfect" profile in that it will miss things that happen infrequently or take very little time, but that's entirely acceptable in a profiler.

I used an in-house profiler with similar sounding functionality a few years back (with some C/assembler not Perl). While the non-invasiveness is handy it does come with it's own set of hassles.

The period of the interrupt can sometimes mesh with the period of the events in your code giving misleading results. At its most basic you can have something like:

while ( 1 ) { foo(); # takes 10 microseconds bar(); # takes 100 microseconds };

and have the interrupt occur in foo() every time because the period of the interrupt matches the period of the loop.

Of course there are ways around this (vary the timing of the interrupt, run multiple profiles) - the technique is certainly not a bad idea in general. However unless you're paying attention the results can occasionally be a lot worse than 'perfectly acceptable'.

Replies are listed 'Best First'.
Re: Re: Dreaming of a Better Profiler
by samtregar (Abbot) on May 25, 2004 at 21:58 UTC
    Yeah, that's mentioned in the article I read. It seems particularly unlikely to bite in Perl given the much longer runtimes for your average Perl subroutine and the variable overhead of all the memory allocation inherent in even well-tuned Perl code.

    -sam