Jeff Weisberg > Devel-DProf-20080628_01 > Devel::DProf

Download:
Devel-DProf-20080628_01.tar.gz

Dependencies

Annotate this POD

Related Modules

Devel::SmallProf
Time::HiRes
Data::Dumper
DBD::Oracle
Apache::DProf
Apache::Registry
Benchmark::Timer
Inline::C
Time::Local
HTML::Template
more...
By perlmonks.org

CPAN RT

Open  0
Report a bug
Module Version: 20080628_01   Source  

NAME ^

Devel::DProf - tell me why my perl program runs so slowly

SYNOPSIS ^

    perl -d:DProf program.pl
    dprofpp

DESCRIPTION ^

The Devel::DProf package is a Perl code profiler.

It is intended to produce output similar to, and compatible with, Devel::DProf, but be 'Less Bad'.

This will collect information on the execution time of a Perl script and of the subs in that script. This information can be used to determine which subroutines are using the most time and which subroutines are being called most often. This information can also be used to create an execution graph of the script, showing subroutine relationships.

To profile a Perl script run the perl interpreter with the -d debugging switch. The profiler uses the debugging hooks. So to profile script test.pl the following command should be used:

    perl5 -d:DProf test.pl

When the script terminates the profiler will dump the profile information to a file called tmon.out. A tool like dprofpp can be used to interpret the information which is in that profile. The following command will print the top 15 subroutines which used the most time:

    dprofpp

To print an execution graph of the subroutines in the script use the following command:

    dprofpp -T

Consult the dprofpp manpage for other options.

ENVIRONMENT ^

PERL_DPROF_OUT_FILE_NAME

Filename to save profile data to, default is tmon.out

BUGS ^

Valid profiling data is not saved until the application terminates and runs this modules END{} block. Applications which cause END{} blocks not to run (such as call _exit or exec) will leave a corrupt and/or incomplete temporary data file.

On most systems, the timing data recorded by this profiler has a granularity of 0.01 second. This may or may not be precise enough for your application.

If the program being profiled contains subroutines which do not return in a normal manner (such as by throwing an exception), the timing data is estimated and may be attributed incorrectly.

Some buggy XS based perl modules can behave erroneously when run under the perl debugger. Since Devel::DProf uses the perl debugger interfaces, these modules will also behave erroneously when being profiled.

Et cetera.

SECURITY ISSUES ^

The standard dprofpp program blindly evals portions of the tmon.out datafile.

SEE ALSO ^

    Devel::Profile
    Devel::DProfLB
    dprofpp
    Yellowstone National Park

AUTHOR ^

    Jeff Weisberg - http://www.tcp4me.com/