in reply to Add a code to first and last line of all the subroutines in a perl package

Would a trace from running it in a debugger suffice? You should be able to use a debugging hook to do what you want without altering any code.
  • Comment on Re: Add a code to first and last line of all the subroutines in a perl package

Replies are listed 'Best First'.
Re^2: Add a code to first and last line of all the subroutines in a perl package
by arunvelusamy (Monk) on Oct 23, 2007 at 06:42 UTC
    Thanks.

    Actually, a non perl tester is going to profile the code. I want them to do profiling in a painless way. The application is very big and Apache::SmallProf makes the application very slow.

    My idea is to add timestamp to begining and end of all subroutines for few packages.

      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!).