| [948e320] | 1 | #!/usr/bin/perl
|
|---|
| 2 | use Path::Class;
|
|---|
| 3 | use File::Basename;
|
|---|
| 4 | use autodie;
|
|---|
| 5 | use strict;
|
|---|
| 6 | use warnings;
|
|---|
| [c55ef7f] | 7 | use File::Path qw(make_path);
|
|---|
| [948e320] | 8 |
|
|---|
| 9 | #my $civlDir="/Users/zmanchun/civl";
|
|---|
| 10 | my $civlDir=".";
|
|---|
| 11 | my $numArgs = scalar(@ARGV);
|
|---|
| 12 | my $outfile="";
|
|---|
| 13 | my $out;
|
|---|
| 14 | my $hasCivlDir=0;
|
|---|
| 15 |
|
|---|
| 16 | if($numArgs > 2){
|
|---|
| 17 | warn "At most ONE argument is needed for this script. Additional arguments will be ignored.\n";
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | if($numArgs > 0){
|
|---|
| 21 | for(my $i=0; $i < 2; $i++){
|
|---|
| 22 | # print "$ARGV[$i]\n";
|
|---|
| 23 | my $arg=$ARGV[$i];
|
|---|
| 24 |
|
|---|
| 25 | if($arg =~ /^\-o(.*)$/){
|
|---|
| 26 | #$outfile=($arg =~ /\-o(\S+)$/);
|
|---|
| 27 | $outfile=$1;
|
|---|
| 28 | # print "outfile is $outfile\n";
|
|---|
| 29 | $out = *STDOUT unless open($out , '>', $outfile );
|
|---|
| 30 | # print "out is $out\n";
|
|---|
| 31 | }else{
|
|---|
| 32 | $civlDir=$arg;
|
|---|
| 33 | $hasCivlDir = 1;
|
|---|
| 34 | }
|
|---|
| 35 | }
|
|---|
| 36 | }
|
|---|
| 37 | if($hasCivlDir==0){
|
|---|
| 38 | warn "No civl directory is provided, the current directory will be used as the civl directory.\n"
|
|---|
| 39 | }
|
|---|
| 40 | if(!defined($out)){
|
|---|
| 41 | # print "use stdout.\n";
|
|---|
| 42 | $out=*STDOUT;
|
|---|
| 43 | }
|
|---|
| 44 | # print "CIVL directory: $civlDir\n";
|
|---|
| 45 | # print "output: $out\n";
|
|---|
| 46 |
|
|---|
| 47 | my $benchPrefix="edu.udel.cis.vsl.civl.bench.scale.";
|
|---|
| 48 | my $cmdStart="java -classpath $civlDir/civl.jar:$civlDir/bin ";
|
|---|
| [c55ef7f] | 49 | my $benchDir = dir("$civlDir/bin/edu/udel/cis/vsl/civl/bench/scale");
|
|---|
| [948e320] | 50 |
|
|---|
| [c55ef7f] | 51 | #print "bench dir is $benchDir\n";
|
|---|
| 52 |
|
|---|
| 53 | while(my $class = $benchDir->next){
|
|---|
| 54 | next unless ($class =~ /\.class$/);
|
|---|
| 55 | my $benchmark;
|
|---|
| 56 |
|
|---|
| 57 | #print "class file path is $class\n";
|
|---|
| 58 | $class = basename("$class", "");
|
|---|
| 59 | #print "class is $class\n";
|
|---|
| 60 | ($benchmark) = ($class =~ /(.*)\.class/);
|
|---|
| 61 | print "Runing benchmark $benchmark...\n";
|
|---|
| 62 | $benchmark = $benchPrefix.$benchmark;
|
|---|
| [948e320] | 63 | my $result = `$cmdStart $benchmark $civlDir`;
|
|---|
| 64 | print $out $result;
|
|---|
| 65 | }
|
|---|
| 66 | print "Scale benchmarks finished.\n"
|
|---|
| 67 |
|
|---|