Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Dreaming of a Better Profiler

by adrianh (Chancellor)
on May 25, 2004 at 21:41 UTC ( #356393=note: print w/replies, xml ) Need Help??

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.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://356393]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (None)
    As of 2021-10-17 04:37 GMT
    Find Nodes?
      Voting Booth?
      My first memorable Perl project was:

      Results (71 votes). Check out past polls.