source: CIVL/scripts/scale/parseScale.pl@ bfbc5f3

1.23 2.0 main test-branch
Last change on this file since bfbc5f3 was 2138309, checked in by Manchun Zheng <zmanchun@…>, 11 years ago

minor correction of scripts; added run.pl to run benchmarks and draw the figure at a time.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@2439 fb995dde-84ed-4084-dfe6-e5aef3e2452c

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