4 chdir( 't' ) if -d 't';
5 unshift @INC, '../lib';
6 require Config; import Config;
7 if ($Config{'extensions'} !~ /\bDevel\/DProf\b/){
8 print "1..0 # Skip: Devel::DProf was not built\n";
14 unlink 'tmon.out', 'err';
17 use Benchmark qw( timediff timestr );
18 use Getopt::Std 'getopts';
23 # -p Name of perl binary
25 @tests = @ARGV ? @ARGV : sort <lib/dprof/*_t lib/dprof/*_v>; # glob-sort, for OS/2
27 $path_sep = $Config{path_sep} || ':';
28 $perl5lib = $opt_I || join( $path_sep, @INC );
29 $perl = $opt_p || $^X;
32 print "tests: @tests\n";
33 print "perl: $perl\n";
34 print "perl5lib: $perl5lib\n";
36 if( $perl =~ m|^\./| ){
37 # turn ./perl into ../perl, because of chdir(t) above.
40 if( ! -f $perl ){ die "Where's Perl?" }
45 local $ENV{PERL5LIB} = $perl5lib;
46 my $opt_d = '-d:DProf';
48 my $t_start = new Benchmark;
49 open( R, "$perl $opt_d $test |" ) || warn "$0: Can't run. $!\n";
52 my $t_total = timediff( new Benchmark, $t_start );
59 print timestr( $t_total, 'nop' ), "\n";
66 system $perl, '-I../lib', '-I./lib/dprof', $test,
67 $opt_v?'-v':'', '-p', $perl;
75 if( $test =~ /_t$/i ){
76 print "# $test" . '.' x (20 - length $test);