in reply to Re^2: Add a code to first and last line of all the subroutines in a perl package
in thread Add a code to first and last line of all the subroutines in a perl package

Read the documentation for Devel::SmallProf (Apache::SmallProf is a fork of it).

These profilers can be configured to only profile certain packages. For instance, create a configuration file named .smallprof in your working directory like:

%DB::packages = qw(Foo Bar);
and only packages Foo and Bar will be profiled. But don't expect it to be much faster. Non-profiled code will still execute much slower (x2 - x5) than without the profiler.

Probably you can also use $^P to explicitly activate/deactivate profiling (see perlvar and perldebguts).

Finally, I would be very glad to collaborate with anyone trying to make Devel::FastProf work with apache (I'm its author!).