Devel::DProf

Devel::DProf is a Perl code profiler. It collects information on the execution time of a Perl script and of the subroutines in that script. To profile a Perl script, run perl with the -d debugging switch:

perl -d:DProf test.pl

When the script terminates (or when the output buffer is filled) the profiler will dump the profile information to a file called tmon.out. A tool such as dprofpp can be used to interpret the information. The following command will print the top 15 subroutines that used the most time:

dprofpp

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

dprofpp -T

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.