|Perl: the Markov chain saw|
Dreaming of a Better Profilerby samtregar (Abbot)
|on May 25, 2004 at 19:27 UTC||Need Help??|
Perl's profilers bite. I should know, I wrote one: Devel::Profiler. It's marginally better than the most common alternative, Devel::DProf, but it's very slow and breaks in many common scenarios. I've got an idea that might produce something better, but I want to get a reality check before I go and dump time into it.
I got the idea while reading an article about Intel's VTune profiler in Doctor Dobb's Journal. VTune works via an interupt handler which wakes up periodically and samples the instruction pointer of the process. 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.
The up-side is that a sampling profiler like VTune is minimally invasive. It doesn't instrument the code being profiled and it can run so fast that it doesn't slow down the code being profiled. This means that the profiling data should be very reliable, corresponding closely to the behavior of the code when it's not being profiled.
So I started wondering what VTune-for-Perl would be like. Here's some random ideas:
Help or pointers to RTFM on any of these topics would be greatly appreciated.
PS: Please don't suggest I use the Perl debugger (it's broken) or fix the Perl debugger (I can't and I think the only person that can is Ilya and he's too busy). If someone did fix the debugger I could just use Devel::DProf and it would probably be good enough. If you want to know what's wrong with the debugger, do a search on perl5-porters for bug-reports concerning seg-faults from Devel::DProf.