| 1 | #!/usr/bin/perl
|
|---|
| 2 | use Math::Round;
|
|---|
| 3 | use File::Path qw(make_path);
|
|---|
| 4 |
|
|---|
| 5 | $resultDir="out";
|
|---|
| 6 | eval { make_path($resultDir) };
|
|---|
| 7 | if ($@) {
|
|---|
| 8 | print "Couldn't create $resultDir: $@";
|
|---|
| 9 | }
|
|---|
| 10 |
|
|---|
| 11 | $output_file = $ARGV[0];
|
|---|
| 12 |
|
|---|
| 13 | open(OUTPUT, "<", $output_file) || die "Could not open $output_file";
|
|---|
| 14 | my $currentName="";
|
|---|
| 15 | #open(my $fileHandle, '>', "$outName") or die "Can't write to file: $!";
|
|---|
| 16 | my $dataFH;
|
|---|
| 17 | open(my $allFH, '>', "scale.dat.tmp") or die "Can't write to file: $!";
|
|---|
| 18 | my $last=3;
|
|---|
| 19 | my $id=0;
|
|---|
| 20 |
|
|---|
| 21 | print $allFH "Name\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15";
|
|---|
| 22 |
|
|---|
| 23 | while ($line=<OUTPUT>) {
|
|---|
| 24 | my($name,$size,$time);
|
|---|
| 25 |
|
|---|
| 26 | chomp($line);
|
|---|
| 27 | next unless ($line =~/^>>>>>>>>\s/);
|
|---|
| 28 |
|
|---|
| 29 | #print $line . "\n";
|
|---|
| 30 | ($name) = ($line =~/^>>>>>>>>\s(.*)\s<<<<<<<<$/);
|
|---|
| 31 |
|
|---|
| 32 | die "no name" unless defined($name);
|
|---|
| 33 | $name =~ tr/ //ds;
|
|---|
| 34 | if($currentName ne $name){
|
|---|
| 35 | $currentName=$name;
|
|---|
| 36 | $id++;
|
|---|
| 37 | if(($id != 1) and ($last <= 15)){
|
|---|
| 38 | for(my $j = $last; $j <= 15; $j++){
|
|---|
| 39 | print $allFH "\t-";
|
|---|
| 40 | }
|
|---|
| 41 | }
|
|---|
| 42 | #print "name = $name\n";
|
|---|
| 43 | print $allFH "\n$name";
|
|---|
| 44 | open($dataFH, '>', "out\/$currentName".".dat") or die "Can't write to file: $!";
|
|---|
| 45 | $last=3;
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | while ($line=<OUTPUT>) {
|
|---|
| 49 | chomp($line);
|
|---|
| 50 | if ($line =~ /time\s\(s\).*:/) {
|
|---|
| 51 | #print $line . "\n";
|
|---|
| 52 | ($time)=($line =~ /time.*:\s*(\S+)\s*$/);
|
|---|
| 53 | last;
|
|---|
| 54 | }
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | while ($line=<OUTPUT>) {
|
|---|
| 58 | chomp($line);
|
|---|
| 59 | if ($line =~ /max\sprocess\scount/) {
|
|---|
| 60 | #print $line . "\n";
|
|---|
| 61 | ($size)=($line =~ /max\sprocess\scount.*:\s*(\d+)\s*$/);
|
|---|
| 62 | last;
|
|---|
| 63 | }
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | die "no size" unless defined($size);
|
|---|
| 67 | die "no time" unless defined($time);
|
|---|
| 68 |
|
|---|
| 69 | $time=round($time);
|
|---|
| 70 | $time=1 if $time==0;
|
|---|
| 71 |
|
|---|
| 72 | print $dataFH $size . "\t" . $time . "\n";
|
|---|
| 73 |
|
|---|
| 74 | next unless ($size >= $last);
|
|---|
| 75 |
|
|---|
| 76 | if($size>$last){
|
|---|
| 77 | #print "size=$size but last=$last\n";
|
|---|
| 78 | for (my $i=$last; $i < $size; $i++) {
|
|---|
| 79 | print $allFH "\t-";
|
|---|
| 80 | }
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 | print $allFH "\t$time";
|
|---|
| 84 | $last=$size+1;
|
|---|
| 85 |
|
|---|
| 86 | # for debugging:
|
|---|
| 87 |
|
|---|
| 88 | #print "size = $size\t";
|
|---|
| 89 | #print "time = $time\n";
|
|---|
| 90 | #print " $type & $name$cite & $result & $loc & $states & $steps & $time & $mem & $valid & $prove & $scale \\\\","\n";
|
|---|
| 91 | }
|
|---|
| 92 | if(($id != 1) and ($last <= 15)){
|
|---|
| 93 | for(my $j = $last; $j <= 15; $j++){
|
|---|
| 94 | print $allFH "\t-";
|
|---|
| 95 | }
|
|---|
| 96 | }
|
|---|
| 97 | close $allFH;
|
|---|
| 98 | open(my $newFH, '>', "scale.dat") or die "Can't write to file: $!";
|
|---|
| 99 | open(DATA, '<', "scale.dat.tmp") or die "Can't open file: $!";
|
|---|
| 100 | my $count=0;
|
|---|
| 101 | my @lines;
|
|---|
| 102 | my $width;
|
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 | while ($line=<DATA>) {
|
|---|
| 106 | chomp($line);
|
|---|
| 107 | @new=split(/\t/, $line);
|
|---|
| 108 | $width=@new;
|
|---|
| 109 | push @lines, [ @new ]; # split = split( ' ', $_ )
|
|---|
| 110 | $count++;
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| 113 | for(my $k=0; $k<$width;$k++){
|
|---|
| 114 | foreach my $row (@lines) {
|
|---|
| 115 | print $newFH $row->[$k] . "\t";
|
|---|
| 116 | }
|
|---|
| 117 | print $newFH "\n";
|
|---|
| 118 | }
|
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 |
|
|---|