DPROFPP(1p)
β¨ DPROFPP(1p) β dprofpp β¨
okay so bestie, welcome to dprofpp, the little tool that reads your Perl profile data and tells you exactly which subroutines are eating your runtime. It lives in the User Contributed Perl Documentation section of the manual, and it is genuinely one of the most useful little gremlins in the Perl toolbox. π
πΈ NAME πΈ
dprofpp β display perl profile data
π¦ 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]
π DESCRIPTION π
So the tea is: the dprofpp command reads in profile data that some profiler made β like the Devel::DProf profiler, for example. It reads the file tmon.out and shows you the 15 subroutines using the most time. And by default, the time reported for each subroutine is exclusive of the time its child subroutines used. Not me being precise about it or anything. π
Wanna profile a Perl script? Run the perl interpreter with the -d switch. So to profile the script test.pl with Devel::DProf, you do:
$ perl5 -d:DProf test.pl
Then you run dprofpp to analyze that profile. Heads up tho β the output of dprofpp depends on the flags you pass and on the version of Perl you're running. π
$ 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 it analyzes the profile data. Those two commands up there? You can do them both with one dprofpp command. main character energy tbh:
$ dprofpp -u -p test.pl
If you want the whole lore on what the raw profile actually looks like, consult "PROFILE FORMAT" in Devel::DProf. π
π OUTPUT π
Here's what the columns mean, bestie β no guessing:
%Timeβ percentage of time spent in this routine.#Callsβ number of calls to this routine.sec/callβ average number of seconds per call to this routine.Nameβ name of routine.CumulSβ time (in seconds) spent in this routine and the routines called from it.ExclSecβ time (in seconds) spent in this routine (not including the ones called from it).Csec/cβ average time (in seconds) spent in each call of this routine (including the ones called from it).
π OPTIONS π
-aβ sort alphabetically by subroutine names.-dβ reverse whatever sort is being used.-Aβ count timing for an autoloaded subroutine as timing for*::AUTOLOAD. Otherwise the time to autoload it gets counted as time of the subroutine itself (and fr there is no way to separate autoload time from run time).
This one is gonna be irrelevant with newer Perls. They'll inform Devel::DProf when the AUTOLOAD switches to an actual subroutine, so separate statistics for AUTOLOAD will get collected no matter whether this option is set or not.
-Rβ count anonymous subroutines defined in the same package separately.-Eβ (default) display all subroutine times exclusive of child subroutine times.-Fβ force the generation of fake exit timestamps ifdprofppreports that the profile is garbled. This is only useful ifdprofppdetermines the profile is garbled due to missing exit timestamps. You're on your own if you do this. Consult the BUGS section. π-Iβ display all subroutine times inclusive of child subroutine times.-lβ sort by number of calls to the subroutines. This may help identify candidates for inlining.-Ocnt β show only cnt subroutines. The default is15.-pscript β tellsdprofppthat it should profile the given script and then interpret its profile data. See-Q.-Qβ used with-pto telldprofppto quit after profiling the script, without interpreting the data.-qβ do not display column headers.-rβ display elapsed real times rather than user+system times.-sβ display system times rather than user+system times.-Tβ display subroutine call tree to stdout. Subroutine statistics are not displayed.-tβ display subroutine call tree to stdout. Subroutine statistics are not displayed. When a function is called multiple consecutive times at the same calling level, it gets displayed once with a repeat count.-Sβ display merged subroutine call tree to stdout. Statistics are displayed for each branch of the tree.
When a function is called multiple (not necessarily consecutive) times in the same branch, all those calls go into one branch of the next level. A repeat count is output together with combined inclusive, exclusive and kids time.
Branches are sorted with regard to inclusive time.
-Uβ do not sort. Display in the order found in the raw profile.-uβ display user times rather than user+system times.-Vβ printdprofpp's version number and exit. If a raw profile is found, then itsXS_VERSIONvariable will be displayed too.-vβ sort by average time spent in subroutines during each call. This may help identify candidates for inlining.-zβ (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" β ignore subroutines except "subroutine" and whatever is called from it.-G<regexp> β aggregate "Group" all calls matching the pattern together. For example this can be used to group all calls of a set of packages:
-G "(package1::)|(package2::)|(package3::)"
or to group subroutines by name:
-G "getNum"
-Pβ used with-Gto aggregate "Pull" together all calls that did not match-G.-f<regexp> β filter all calls matching the pattern.-hβ display brief help and exit.-Hβ display long help and exit.
π 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.
Real talk: 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. π
π 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 "BUGS" in Devel::DProf.
Mail bug reports and feature requests to the perl5-porters mailing list at <perl5-porters@perl.org>. Bug reports should include the output of the -V option. (Yes bestie, actually include the -V output, they're not joking. π«Ά)
π FILES π
dprofpp - profile processor
tmon.out - raw profile
β SEE ALSO β
perl, Devel::DProf, times(2)
And that's the whole page, gorgeous. This little masterpiece ships with perl v5.42.3, dated 2026-08-19. Go profile something and find out which subroutine is secretly the villain of your script. π§ββοΈπ
π¦ where this page comes from
- ubuntu stonking: libdevel-dprof-perl 20110802.00-5build6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms