dprofpp - display perl profile data
2. SYNOPSIS ▲
dprofpp [-a|-z|-l|-v|-U] [-d] [-s|-r|-u] [-q] [-F] [-I|-E] [-O cnt] [-A] [-R] [-S] [-g subroutine] [-G <regexp> [-P]] [-f <regexp>] [profile]
dprofpp -T [-F] [-g subroutine] [profile]
dprofpp -t [-F] [-g subroutine] [profile]
dprofpp -G <regexp> [-P] [profile]
dprofpp -p script [-Q] [other opts]
dprofpp -V [profile]
3. DESCRIPTION ▲
The dprofpp command interprets profile data produced by a profiler, such as the Devel::DProf profiler. Dprofpp will read the file tmon.out and display the 15 subroutines which are using the most time. By default the times for each subroutine are given exclusive of the times of their child subroutines.
To profile a Perl script run the perl interpreter with the -d switch. So to profile script test.pl with Devel::DProf use the following:
$ perl5 -d:DProf test.pl
Then run dprofpp to analyze the profile. The output of dprofpp depends on the flags to the program and the version of Perl you're using.
$ dprofpp -u Total Elapsed Time = 1.67 Seconds User Time = 0.61 Seconds Exclusive Times %Time Seconds #Calls sec/call Name 52.4 0.320 2 0.1600 main::foo 45.9 0.280 200 0.0014 main::bar 0.00 0.000 1 0.0000 DynaLoader::import 0.00 0.000 1 0.0000 main::baz
The dprofpp tool can also run the profiler before analyzing the profile data. The above two commands can be executed with one dprofpp command.
$ dprofpp -u -p test.pl
Consult \*(L"PROFILE FORMAT\*(R" in Devel::DProf for a description of the raw profile.
4. OUTPUT ▲
%Time 4 Percentage of time spent in this routine.
#Calls 4 Number of calls to this routine.
sec/call 4 Average number of seconds per call to this routine.
Name 4 Name of routine.
CumulS 4 Time (in seconds) spent in this routine and routines called from it.
ExclSec 4 Time (in seconds) spent in this routine (not including those called from it).
Csec/c 4 Average time (in seconds) spent in each call of this routine (including those called from it).
5. OPTIONS ▲
-a 5 Sort alphabetically by subroutine names.
-d 5 Reverse whatever sort is used
-A 5 Count timing for autoloaded subroutine as timing for \f(CW*::AUTOLOAD\fR. Otherwise the time to autoload it is counted as time of the subroutine itself (there is no way to separate autoload time from run time). .Sp This is going to be irrelevant with newer Perls. They will inform \f(CW\*(C`Devel::DProf\*(C'\fR when the \f(CW\*(C`AUTOLOAD\*(C'\fR switches to actual subroutine, so a separate statistics for \f(CW\*(C`AUTOLOAD\*(C'\fR will be collected no matter whether this option is set.
-R 5 Count anonymous subroutines defined in the same package separately.
-E 5 (default) Display all subroutine times exclusive of child subroutine times.
-F 5 Force the generation of fake exit timestamps if dprofpp reports that the profile is garbled. This is only useful if dprofpp determines that the profile is garbled due to missing exit timestamps. You're on your own if you do this. Consult the BUGS section.
-I 5 Display all subroutine times inclusive of child subroutine times.
-l 5 Sort by number of calls to the subroutines. This may help identify candidates for inlining.
-O cnt 5 Show only cnt subroutines. The default is 15.
-p script 5 Tells dprofpp that it should profile the given script and then interpret its profile data. See -Q.
-Q 5 Used with -p to tell dprofpp to quit after profiling the script, without interpreting the data.
-q 5 Do not display column headers.
-r 5 Display elapsed real times rather than user+system times.
-s 5 Display system times rather than user+system times.
-T 5 Display subroutine call tree to stdout. Subroutine statistics are not displayed.
-t 5 Display subroutine call tree to stdout. Subroutine statistics are not displayed. When a function is called multiple consecutive times at the same calling level then it is displayed once with a repeat count.
-S 5 Display merged subroutine call tree to stdout. Statistics are displayed for each branch of the tree. .Sp When a function is called multiple (not necessarily consecutive) times in the same branch then all these calls go into one branch of the next level. A repeat count is output together with combined inclusive, exclusive and kids time. .Sp Branches are sorted with regard to inclusive time.
-U 5 Do not sort. Display in the order found in the raw profile.
-u 5 Display user times rather than user+system times.
-V 5 Print dprofpp's version number and exit. If a raw profile is found then its XS_VERSION variable will be displayed, too.
-v 5 Sort by average time spent in subroutines during each call. This may help identify candidates for inlining.
-z 5 (default) Sort by amount of user+system time used. The first few lines should show you which subroutines are using the most time.
-g subroutine 5 Ignore subroutines except \f(CW\*(C`subroutine\*(C'\fR and whatever is called from it.
-G <regexp> 5 Aggregate \*(L"Group\*(R" all calls matching the pattern together. For example this can be used to group all calls of a set of packages .Sp -G "(package1::)|(package2::)|(package3::)"
.Sp or to group subroutines by name: .Sp -G "getNum"
-P 5 Used with -G to aggregate \*(L"Pull\*(R" together all calls that did not match -G.
-f <regexp> 5 Filter all calls matching the pattern.
-h 5 Display brief help and exit.
-H 5 Display long help and exit.
6. ENVIRONMENT ▲
The environment variable DPROFPP_OPTS can be set to a string containing options for dprofpp. You might use this if you prefer -I over -E or if you want -F on all the time.
This was added fairly lazily, so there are some undesirable side effects. Options on the commandline should override options in DPROFPP_OPTS--but don't count on that in this version.
7. BUGS ▲
Applications which call _exit() or exec() from within a subroutine will leave an incomplete profile. See the -F option.
Any bugs in Devel::DProf, or any profiler generating the profile data, could be visible here. See \*(L"BUGS\*(R" in Devel::DProf.
Mail bug reports and feature requests to the perl5-porters mailing list at <>. Bug reports should include the output of the -V option.
8. FILES ▲
dprofpp - profile processor tmon.out - raw profile
9. SEE ALSO ▲
perl, Devel::DProf, times (2)