#! perl -slw use strict; use Data::Dumper; use Benchmark::Timer; our $FUZZ ||= 2; our $MEM ||= 0; our $ITERS ||= -2; my $T = new Benchmark::Timer; my %tests; @ARGV = map quotemeta, @ARGV; for my $seqFile ( glob 'seq.*' ) { for my $fragFile ( glob 'frg.*' ) { my $test = sprintf '[%s][%s]', $fragFile, $seqFile; for my $candidate ( @ARGV ) { my $cmd = qq[ $candidate -FUZZ=$FUZZ -MEM=$MEM $fragFile $seqFile 2>&1 1> $candidate\\"$test".out ]; $cmd =~ s[\s+][ ]g; #print "'$cmd'"; for ( 1 .. $ITERS ) { $T->start( $test . $candidate ); my $result = `$cmd`; $T->stop( $test . $candidate ); #print "'$result'"; if( my( $found, $time, $mem, $scale ) = $result =~ m[Found (\d+) matches in \(secs\): ([\d\.]+) Mem: ([\d,]+) K] ) { $tests{ $test }{ $candidate }{ found } += $found; $tests{ $test }{ $candidate }{ time } += $time; $mem =~ tr[,][]d; $tests{ $test }{ $candidate }{ mem } += $mem; } else { warn "Bad return data: '$result'"; } } $tests{ $test }{ $candidate }{ $_ } /= $ITERS for qw[ found time mem ]; } } } for my $test ( sort keys %tests ) { print "\n------ $test"; print " Who: Matches Secs(ave) Memory"; printf "%10s: %9d %8.3f %9d\n", $_, @{ $tests{ $test }{ $_ } }{ qw[ found time mem ] } for @ARGV; }