How To Profile a Perl Script

Perl Profiling can be done by using the DProf debugging switch:

# perl -d:DProf test.pl
hello

# ls
test.pl  tmon.out

# dprofpp tmon.out

Total Elapsed Time = 0.009982 Seconds
User+System Time = 0.009982 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
100.   0.010  0.010      1   0.0100 0.0100  warnings::BEGIN
0.00       – -0.000      1        -      -  strict::import
0.00       – -0.000      1        -      -  strict::bits
0.00       – -0.000      1        -      -  warnings::import
0.00       -  0.010      2        – 0.0050  main::BEGIN

Common options:

-O cnt Show only cnt subroutines. The default is 15.

-r Display elapsed real times rather than user+system times.

-s Display system times rather than user+system times.

-u Display user times rather than user+system times.

This entry was posted in Perl. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>