4 chdir( 't' ) if -d 't';
6 require Config; import Config;
7 if ($Config{'extensions'} !~ /\bDevel\/DProf\b/){
8 print "1..0 # Skip: Devel::DProf was not built\n";
14 while(-e 'tmon.out' && unlink 'tmon.out') {}
15 while(-e 'err' && unlink 'err') {}
18 use Benchmark qw( timediff timestr );
19 use Getopt::Std 'getopts';
24 # -p Name of perl binary
26 @tests = @ARGV ? @ARGV : sort (<lib/dprof/*_t>, <lib/dprof/*_v>); # glob-sort, for OS/2
28 $path_sep = $Config{path_sep} || ':';
29 $perl5lib = $opt_I || join( $path_sep, @INC );
30 $perl = $opt_p || $^X;
33 print "tests: @tests\n";
34 print "perl: $perl\n";
35 print "perl5lib: $perl5lib\n";
37 if( $perl =~ m|^\./| ){
38 # turn ./perl into ../perl, because of chdir(t) above.
41 if( ! -f $perl ){ die "Where's Perl?" }
46 local $ENV{PERL5LIB} = $perl5lib;
47 my $opt_d = '-d:DProf';
49 my $t_start = new Benchmark;
50 open( R, "$perl \"$opt_d\" $test |" ) || warn "$0: Can't run. $!\n";
53 my $t_total = timediff( new Benchmark, $t_start );
60 print '# ',timestr( $t_total, 'nop' ), "\n";
67 my $command = $perl.' "-I../lib" "-I./lib/dprof" '.$test;
68 $command .= ' -v' if $opt_v;
69 $command .= ' -p '. $perl;
78 $test =~ s/\.$// if $^O eq 'VMS';
79 if( $test =~ /_t$/i ){
80 print "# $test" . '.' x (20 - length $test);