Devel::FastProf(3p)

NAME
Devel::FastProf - "fast" perl per-line profiler

SYNOPSIS
  $ perl -d:FastProf my_script.pl
  $ fprofpp -t 10

ABSTRACT
Devel::FastProf tells you how much time has been spent on every line of your program.

DESCRIPTION
"Devel::FastProf" is a perl per-line profiler. What that means is that it can tell you how much time is spent on every line of a perl script (the standard Devel::DProf is a per-subroutine profiler).

I have been the maintainer of Devel::SmallProf for some time and although I found it much more useful that Devel::DProf, it had an important limitation: it was terribly slow, around 50 times slower than the profiled script being run out of the profiler.

So, I rewrote it from scratch in C, and the result is "Devel::FastProf", that runs only between 3 and 5 times slower than under normal execution... well, maybe I should have called it "Devel::NotSoSlowProf" ;-)

To use "Devel::FastProf" with your programs, you have to call perl with the "-d" switch (see perlrun) as follows:

  $ perl -d:FastProf my_script.pl

"Devel::FastProf" will write the profiling information to a file named "fastprof.out" under the current directory.

To analyse the information on this file use the post processor script fprofpp included with this package.

Some options can be passed to "Devel::FastProf" via the environment variable "FASTPROF_CONFIG":

filename=otherfn.out
    allows to change the name of the output file.

usecputime
    by default, "Devel::FastProf" meassures the wall clock time spent on every line, but if this entry is included it will use the cpu time (user+system) instead.

canfork
    this option has to be used if the profiled script forks new processes, if you forget to do so, a corrupted "fastprof.out" file could be generated.

    Activating this mode causes a big performance penalty because write operations from all the processes have to be serialized using locks. That is why it is not active by default.

This is an example of how to set those options:

  $ FASTPROF_CONFIG="usecputime,filename=/tmp/fp.out" \
      perl -d:FastProf myscript.pl

BUGS
No Windows! No threads!

Only tested on Linux. It is know not to work under Solaris.

The code of subroutines defined inside "eval "..."" constructions that do not include any other code will not be available on the reports. This is caused by a limitation on the perl interpreter.

Option -g is buggy, it only works when all the modules are loaded in the original process.

Perl 5.8.8 or later is recomended. Older versions have a bug that cause this profiler to be slower.

If you find any bug, please, send me an e-mail to sfandino@yahoo.com or report it via the CPAN RT system.

SEE ALSO
fprofpp, perlrun, Devel::SmallProf, Devel::Dprof, perldebug and perldebguts.

COPYRIGHT AND LICENSE
Copyright (C) 2005-2007 by Salvador Fandiño <sfandino@yahoo.com>.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.