| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | $curr_dir = "c://projects//cloudy//trunk//tsuite"; |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | $lgdir = 'itrlogs/'; |
|---|
| 24 | |
|---|
| 25 | if ( !chdir ($curr_dir)) |
|---|
| 26 | { |
|---|
| 27 | printf (" invalid directory\n"); |
|---|
| 28 | exit; |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | if ( !-e $lgdir) |
|---|
| 33 | { |
|---|
| 34 | system "mkdir $lgdir"; |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | if ( !chdir ( "$curr_dir/auto" ) ) |
|---|
| 39 | { |
|---|
| 40 | printf (" invalid directory\n"); |
|---|
| 41 | exit; |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | $tlog = 'itrzn.log'; |
|---|
| 45 | $efile = 'mailitr.log'; |
|---|
| 46 | $exitr= 'extime_itrzn.log'; |
|---|
| 47 | $tholditr = 5; |
|---|
| 48 | $tholdetime = 10; |
|---|
| 49 | $flag=0; |
|---|
| 50 | $no_itr=0; |
|---|
| 51 | $no_extime=0; |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | open (LGFILE, ">$tlog"); |
|---|
| 55 | open (ELOG, ">$efile"); |
|---|
| 56 | open (EXITR, ">$exitr"); |
|---|
| 57 | print ELOG "List of models with increase in itr/zn and/or execution time\n\n"; |
|---|
| 58 | print EXITR "Model\tExectime\titr/zn\n"; |
|---|
| 59 | |
|---|
| 60 | print LGFILE "Records of itr/zn and Exectime of models if .bak file exists"; |
|---|
| 61 | print LGFILE "\n************************************************************"; |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | while (defined ($ofile = glob ("*.out"))) |
|---|
| 65 | { |
|---|
| 66 | $bfile = $ofile; |
|---|
| 67 | $bfile =~s/\.out/\.bak/; |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | open (OUTFILE,"$ofile"); |
|---|
| 72 | $lfile = $ofile; |
|---|
| 73 | $lfile =~s/\.out/\.log/; |
|---|
| 74 | $lfile =~s/$lfile/$curr_dir\/$lgdir\/$lfile/; |
|---|
| 75 | $present=0; |
|---|
| 76 | if(-e $lfile) |
|---|
| 77 | { |
|---|
| 78 | $present=1; |
|---|
| 79 | |
|---|
| 80 | |
|---|
| 81 | open (LFILE, "$lfile"); |
|---|
| 82 | $count=0; |
|---|
| 83 | |
|---|
| 84 | while($log = <LFILE>) |
|---|
| 85 | { |
|---|
| 86 | $log=~s/(.*Exectime\t\s)(\d*\.\d*|\d*)(.*)/$2/; |
|---|
| 87 | $exectime[$count] = $log; |
|---|
| 88 | $count = $count + 1; |
|---|
| 89 | } |
|---|
| 90 | close(LFILE); |
|---|
| 91 | } |
|---|
| 92 | else |
|---|
| 93 | { |
|---|
| 94 | print "No files present"; |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | if($present==1) |
|---|
| 98 | { |
|---|
| 99 | $total = 0; |
|---|
| 100 | if($count>10) |
|---|
| 101 | { |
|---|
| 102 | for($i = $count-1; $i> ($count-11); $i = $i-1) |
|---|
| 103 | { |
|---|
| 104 | $total = $total + $exectime[$i]; |
|---|
| 105 | } |
|---|
| 106 | $ave = $total / 10; |
|---|
| 107 | } |
|---|
| 108 | else |
|---|
| 109 | { |
|---|
| 110 | for($i = $count-1; $i>-1; $i = $i-1) |
|---|
| 111 | { |
|---|
| 112 | $total = $total + $exectime[$i]; |
|---|
| 113 | } |
|---|
| 114 | if($count>1) |
|---|
| 115 | { |
|---|
| 116 | $ave = $total / ($count-1); |
|---|
| 117 | } |
|---|
| 118 | else |
|---|
| 119 | { |
|---|
| 120 | $ave=$total; |
|---|
| 121 | } |
|---|
| 122 | } |
|---|
| 123 | } |
|---|
| 124 | |
|---|
| 125 | |
|---|
| 126 | open (LOGFILE, ">>$lfile"); |
|---|
| 127 | |
|---|
| 128 | |
|---|
| 129 | ($sec,$min,$hour,$mday,$mon,$year) = localtime(time); |
|---|
| 130 | $mon = $mon+1; |
|---|
| 131 | $year =~s/^\d//; |
|---|
| 132 | print LOGFILE "Date\t$mon/$mday/$year\tTime\t$hour:$min:$sec"; |
|---|
| 133 | |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | if (-e $bfile) |
|---|
| 137 | { |
|---|
| 138 | open (BKFILE,"$bfile"); |
|---|
| 139 | $mo = $ofile; |
|---|
| 140 | $mo =~s/\.out//; # removes '.out' |
|---|
| 141 | print LGFILE "\nModel : $mo\n"; |
|---|
| 142 | |
|---|
| 143 | |
|---|
| 144 | |
|---|
| 145 | while ($bk = <BKFILE>) |
|---|
| 146 | { |
|---|
| 147 | if ($bk=~/itr\/zn\:/) |
|---|
| 148 | { |
|---|
| 149 | $prev_itr = $bk; |
|---|
| 150 | $prev_itr =~s/(.*itr\/zn\:)(\s\d*\.\d*|\d*\.\d*)(\s*.*)/$2/gi; |
|---|
| 151 | $prev_itr =~s/\n//; |
|---|
| 152 | print LGFILE "Previous itr/zn : $prev_itr\t"; |
|---|
| 153 | } |
|---|
| 154 | elsif ($bk=~/ExecTime/) |
|---|
| 155 | { |
|---|
| 156 | $prev_etime = $bk; |
|---|
| 157 | $prev_etime =~s/.*ExecTime\(s\)//gi; # gives the execution time |
|---|
| 158 | print LGFILE "Previous Exectime : $prev_etime"; |
|---|
| 159 | } |
|---|
| 160 | } |
|---|
| 161 | |
|---|
| 162 | |
|---|
| 163 | while ($new = <OUTFILE>) |
|---|
| 164 | { |
|---|
| 165 | if ($new=~/itr\/zn\:/) |
|---|
| 166 | { |
|---|
| 167 | $curr_itr = $new; |
|---|
| 168 | $curr_itr =~s/(.*itr\/zn\:)(\s\d*\.\d*|\d*\.\d*)(\s*.*)/$2/gi; |
|---|
| 169 | $curr_itr =~s/\n//; |
|---|
| 170 | print LGFILE "New itr/zn : $curr_itr\t"; |
|---|
| 171 | } |
|---|
| 172 | elsif ($new=~/ExecTime/) |
|---|
| 173 | { |
|---|
| 174 | $curr_etime = $new; |
|---|
| 175 | $curr_etime =~s/.*ExecTime\(s\)//gi; # gives the execution time |
|---|
| 176 | print LGFILE "New Exectime : $curr_etime"; |
|---|
| 177 | } |
|---|
| 178 | } |
|---|
| 179 | |
|---|
| 180 | |
|---|
| 181 | $diff_itr = $curr_itr - $prev_itr; |
|---|
| 182 | printf(LGFILE "Difference in itr/zn: %.2f\n", $diff_itr); |
|---|
| 183 | |
|---|
| 184 | |
|---|
| 185 | |
|---|
| 186 | |
|---|
| 187 | if ($diff_itr !~/^-/) |
|---|
| 188 | { |
|---|
| 189 | if ($prev_itr > 0) |
|---|
| 190 | { |
|---|
| 191 | $ptage = ($diff_itr / $prev_itr) * 100; |
|---|
| 192 | $ptage = sprintf "%.2f", $ptage; |
|---|
| 193 | if ($ptage > $tholditr) |
|---|
| 194 | { |
|---|
| 195 | print LGFILE "% increase of itr/zn which is beyond the set threshold of 5: $ptage \n"; |
|---|
| 196 | |
|---|
| 197 | $itr[$no_itr]="$mo\t$ptage%"; |
|---|
| 198 | $no_itr = $no_itr + 1; |
|---|
| 199 | $flag = 1; |
|---|
| 200 | } |
|---|
| 201 | } |
|---|
| 202 | } |
|---|
| 203 | |
|---|
| 204 | if($present == 1) |
|---|
| 205 | { |
|---|
| 206 | |
|---|
| 207 | $diff_etime = $curr_etime - $ave; |
|---|
| 208 | printf(LGFILE "Increase/Decrease in execution time from the average: %.2f\n", $diff_etime); |
|---|
| 209 | |
|---|
| 210 | |
|---|
| 211 | if ($diff_etime >0) |
|---|
| 212 | { |
|---|
| 213 | if ($ave > 0) |
|---|
| 214 | { |
|---|
| 215 | $ptage = ($diff_etime / $ave) * 100; |
|---|
| 216 | $ptage = sprintf "%.2f", $ptage; |
|---|
| 217 | |
|---|
| 218 | if ($ptage > $tholdetime) |
|---|
| 219 | { |
|---|
| 220 | print LGFILE "% increase in execution time which is more the set threshold of 10 percent: $ptage \n"; |
|---|
| 221 | $extime[$no_extime]="$mo\t$ptage%"; |
|---|
| 222 | $no_extime = $no_extime + 1; |
|---|
| 223 | $flag = 1; |
|---|
| 224 | } |
|---|
| 225 | } |
|---|
| 226 | } |
|---|
| 227 | } |
|---|
| 228 | } |
|---|
| 229 | |
|---|
| 230 | |
|---|
| 231 | $curr_etime =~s/\n//; |
|---|
| 232 | print LOGFILE "\t Exectime\t$curr_etime\titr/zn\t$curr_itr\n"; |
|---|
| 233 | print EXITR "$mo\t$curr_etime\t$curr_itr\n"; |
|---|
| 234 | close (LOGFILE); |
|---|
| 235 | } |
|---|
| 236 | |
|---|
| 237 | print ELOG "Models with 10% increase in ExecTime than the average of previous 10 models:\n"; |
|---|
| 238 | print ELOG "---------------------------------------------------------------------------\n"; |
|---|
| 239 | for( $noe=0; $noe<$no_extime; ++$noe){ |
|---|
| 240 | print ELOG "$extime[$noe]\n"; |
|---|
| 241 | } |
|---|
| 242 | print ELOG "\n\n\nModels with 5% increase than previous itr/zn):\n"; |
|---|
| 243 | print ELOG "-------------------------------------------------\n"; |
|---|
| 244 | for( $noi=0; $noi<$no_itr; ++$noi){ |
|---|
| 245 | print ELOG "$itr[$noi]\n"; |
|---|
| 246 | } |
|---|
| 247 | close (EXITR); |
|---|
| 248 | close (BKFILE); |
|---|
| 249 | close (OUTFILE); |
|---|
| 250 | close (LGFILE); |
|---|
| 251 | close (ELOG); |
|---|
| 252 | |
|---|
| 253 | |
|---|
| 254 | |
|---|
| 255 | if (-e $efile){ |
|---|
| 256 | if($flag == 1){ |
|---|
| 257 | |
|---|
| 258 | |
|---|
| 259 | |
|---|
| 260 | |
|---|
| 261 | |
|---|
| 262 | |
|---|
| 263 | |
|---|
| 264 | |
|---|
| 265 | |
|---|
| 266 | system("c:\\u\\blat\\blat.exe $efile -t gary\@pa.uky.edu -s \"Increase in exe time and itr/zn found in automatic testing\" " ); |
|---|
| 267 | |
|---|
| 268 | |
|---|
| 269 | |
|---|
| 270 | |
|---|
| 271 | |
|---|
| 272 | |
|---|
| 273 | |
|---|
| 274 | |
|---|
| 275 | |
|---|
| 276 | |
|---|
| 277 | } |
|---|
| 278 | } |
|---|
| 279 | unlink($efile); |
|---|
| 280 | |
|---|