ext/re/aix.pl can go
[p5sagit/p5-mst-13.2.git] / utils / dprofpp.PL
index c513062..51e8d78 100644 (file)
@@ -14,25 +14,22 @@ use File::Basename qw(&basename &dirname);
 # This is so that make depend always knows where to find PL derivatives.
 chdir(dirname($0));
 ($file = basename($0)) =~ s/\.PL$//;
-$file =~ s/\.pl$//
-       if ($Config{'osname'} eq 'VMS' or
-           $Config{'osname'} eq 'OS2');  # "case-forgiving"
+$file =~ s/\.pl$// if ($Config{'osname'} eq 'OS2');      # "case-forgiving"
+$file =~ s/\.pl$/.com/ if ($Config{'osname'} eq 'VMS');  # "case-forgiving"
 
-print "Pulling version from Makefile for dprofpp...\n";
+my $dprof_pm = '../ext/Devel/DProf/DProf.pm';
 my $VERSION = 0;
-open( MK, "<Makefile" ) || die "Can't open Makefile: $!";
-while(<MK>){
-       if( /^VERSION\s*=\s*(\d+)/ ){
+open( PM, "<$dprof_pm" ) || die "Can't open $dprof_pm: $!";
+while(<PM>){
+       if( /^\$Devel::DProf::VERSION\s*=\s*'([\d._]+)'/ ){
                $VERSION = $1;
                last;
        }
 }
-close MK;
+close PM;
 if( $VERSION == 0 ){
-       die "Did not find VERSION in Makefile";
+       die "Did not find VERSION in $dprof_pm";
 }
-print "   version is ($VERSION).\n";
-
 open OUT,">$file" or die "Can't create $file: $!";
 
 print "Extracting $file (with variable substitutions)\n";
@@ -47,7 +44,7 @@ $Config{'startperl'}
 
 require 5.003;
 
-my \$VERSION = $VERSION;
+my \$VERSION = '$VERSION';
 
 !GROK!THIS!
 
@@ -84,7 +81,8 @@ be used.
 
        $ perl5 -d:DProf test.pl
 
-Then run dprofpp to analyze the profile.
+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
@@ -103,6 +101,44 @@ data.  The above two commands can be executed with one dprofpp command.
 
 Consult L<Devel::DProf/"PROFILE FORMAT"> for a description of the raw profile.
 
+=head1 OUTPUT
+
+Columns are:
+
+=over 4
+
+=item %Time
+
+Percentage of time spent in this routine.
+
+=item #Calls
+
+Number of calls to this routine.
+
+=item sec/call
+
+Average number of seconds per call to this routine.
+
+=item Name
+
+Name of routine.
+
+=item CumulS
+
+Time (in seconds) spent in this routine and routines called from it.
+
+=item ExclSec
+
+Time (in seconds) spent in this routine (not including those called
+from it).
+
+=item Csec/c
+
+Average time (in seconds) spent in each call of this routine
+(including those called from it).
+
+=back
+
 =head1 OPTIONS
 
 =over 5
@@ -400,6 +436,8 @@ Main: {
 #
 sub settime {
   my( $runtime, $hz ) = @_;
+
+  $hz ||= 1;
   
   if( $opt_r ){
     $$runtime = ($rrun_rtime - $overhead - $over_rtime * $total_marks/$over_tests/2)/$hz;