5 use Benchmark qw( timediff timestr );
6 use Getopt::Std 'getopts';
12 # -p Name of perl binary
14 unless (-r 'dprofpp' and -M 'dprofpp' <= -M 'dprofpp.PL') {
15 print STDERR "dprofpp out of date, extracting...\n";
16 system 'perl', 'dprofpp.PL' and die 'perl dprofpp.PL: exit code $?, $!';
18 die "Need dprofpp, could not make it" unless -r 'dprofpp';
20 chdir( 't' ) if -d 't';
21 @tests = @ARGV ? @ARGV : sort <*.t *.v>; # glob-sort, for OS/2
23 $path_sep = $Config{path_sep} || ':';
25 unshift @INC, '../blib/arch', '../blib/lib';
27 $perl5lib = $opt_I || join( $path_sep, @INC );
28 $perl = $opt_p || $^X;
31 print "tests: @tests\n";
32 print "perl: $perl\n";
33 print "perl5lib: $perl5lib\n";
35 if( $perl =~ m|^\./| ){
36 # turn ./perl into ../perl, because of chdir(t) above.
39 if( ! -f $perl ){ die "Where's Perl?" }
44 local $ENV{PERL5LIB} = $perl5lib;
45 my $opt_d = '-d:DProf';
47 my $t_start = new Benchmark;
48 open( R, "$perl $opt_d $test |" ) || warn "$0: Can't run. $!\n";
51 my $t_total = timediff( new Benchmark, $t_start );
58 print timestr( $t_total, 'nop' ), "\n";
65 system $perl, '-I.', $test, $opt_v?'-v':'', '-p', $perl;
72 print $test . '.' x (20 - length $test);