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

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

added scripts for generating scale experiments figure

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

  • Property mode set to 100755
File size: 2.6 KB
Line 
1#!/usr/bin/perl
2use Math::Round;
3use File::Path qw(make_path);
4
5$resultDir="out";
6eval { make_path($resultDir) };
7if ($@) {
8 print "Couldn't create $resultDir: $@";
9}
10
11$output_file = $ARGV[0];
12
13open(OUTPUT, "<", $output_file) || die "Could not open $output_file";
14my $currentName="";
15#open(my $fileHandle, '>', "$outName") or die "Can't write to file: $!";
16my $dataFH;
17open(my $allFH, '>', "scale.dat.tmp") or die "Can't write to file: $!";
18my $last=3;
19my $id=0;
20
21print $allFH "Name\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15";
22
23while ($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}
92if(($id != 1) and ($last <= 15)){
93 for(my $j = $last; $j <= 15; $j++){
94 print $allFH "\t-";
95 }
96}
97close $allFH;
98open(my $newFH, '>', "scale.dat") or die "Can't write to file: $!";
99open(DATA, '<', "scale.dat.tmp") or die "Can't open file: $!";
100my $count=0;
101my @lines;
102my $width;
103
104
105while ($line=<DATA>) {
106 chomp($line);
107 @new=split(/\t/, $line);
108 $width=@new;
109 push @lines, [ @new ]; # split = split( ' ', $_ )
110 $count++;
111}
112
113for(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
Note: See TracBrowser for help on using the repository browser.