| 1 | #!/usr/bin/perl
|
|---|
| 2 | use Path::Class;
|
|---|
| 3 | use File::Basename;
|
|---|
| 4 | use autodie;
|
|---|
| 5 | use strict;
|
|---|
| 6 | use warnings;
|
|---|
| 7 | use File::Path qw(make_path);
|
|---|
| 8 |
|
|---|
| 9 | my $civlDir="."; # directory to civl
|
|---|
| 10 | my $numArgs = scalar(@ARGV);
|
|---|
| 11 | my $datOut = ".";
|
|---|
| 12 | my $benchOut = "bench.scale.out";
|
|---|
| 13 | my $hasCivlDir=0;
|
|---|
| 14 | my $datDir;
|
|---|
| 15 |
|
|---|
| 16 | for(my $i=0; $i < $numArgs; $i++){
|
|---|
| 17 | my $arg = $ARGV[$i];
|
|---|
| 18 |
|
|---|
| 19 | if($arg =~ /^\-d(.*)$/){
|
|---|
| 20 | $civlDir=$1;
|
|---|
| 21 | $hasCivlDir=1;
|
|---|
| 22 | }elsif ($arg =~ /^\-o(.*)$/){
|
|---|
| 23 | $datOut = $1;
|
|---|
| 24 | #if(!($datOut =~ /\.pdf$/)){
|
|---|
| 25 | #warn "$out is not a pdf file name, $out.pdf will be used for output file instead.\n";
|
|---|
| 26 | # $out="$out.pdf";
|
|---|
| 27 | # }
|
|---|
| 28 | }else{
|
|---|
| 29 | warn "Arguments should start with -d or -o, invalid argument $arg would be ignored.\n";
|
|---|
| 30 | }
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 | if($hasCivlDir == 0){
|
|---|
| 34 | warn "no civl directory is provided, current directory will be used as the civl directory.\n";
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | unless (-d $datOut) {
|
|---|
| 38 | mkdir $datOut;
|
|---|
| 39 | }
|
|---|
| 40 | $benchOut="$datOut/$benchOut";
|
|---|
| 41 |
|
|---|
| 42 | my $scriptPrefix="$civlDir/scripts/scale";
|
|---|
| 43 |
|
|---|
| 44 | print "running scale benchmarks...\n";
|
|---|
| 45 | my $cmd = `$scriptPrefix/runBenchScale.pl $civlDir -o$benchOut`;
|
|---|
| 46 | print "scale benchmarks finished, now generating .dat file in $datOut...\n";
|
|---|
| 47 | $cmd = `$scriptPrefix/parseScale.pl $benchOut $datOut`;
|
|---|
| 48 | print ".dat file finished, now generating figure...\n";
|
|---|
| 49 |
|
|---|
| 50 | $datDir=dir("$datOut");
|
|---|
| 51 | while(my $datFile = $datDir->next){
|
|---|
| 52 | next unless ($datFile =~ /\.dat$/);
|
|---|
| 53 | my $benchmark;
|
|---|
| 54 |
|
|---|
| 55 | $datFile = basename($datFile, "");
|
|---|
| 56 | ($benchmark) = ($datFile =~ /(.*)\.dat/);
|
|---|
| 57 | if($benchmark eq "Diningphilosopher"){
|
|---|
| 58 | $benchmark="Dining philosopher";
|
|---|
| 59 | }
|
|---|
| 60 | print "plotting figure for benchmark $benchmark...\n";
|
|---|
| 61 | $cmd = `gnuplot -e "TITLE='$benchmark'" -e "DAT_FILE='$datOut/$datFile'" -e "OUT_FILE='$datOut/$benchmark.pdf'" $scriptPrefix/plotBench.plg`;
|
|---|
| 62 | }
|
|---|
| 63 | print "scaling figures is successfully generated in $datOut\n";
|
|---|