2016年9月6日 星期二

Analysis pass rate for CCSN consistency

Code:
$LC_LOG = $ARGV[0];
$index_X = $ARGV[1];
$index_Y = $ARGV[2];
open(h2,"+>temp.log");

my @all_fail = 0;

##### Get X index values #####
open(XFile,"<$index_X");
while(<XFile>){
chop $_;
@X_ary=split(",",$_);
}
foreach $X_value (@X_ary)
{
print "X array vlues:$X_value\n";
}


##### Get Y index values #####
open(YFile,"<$index_Y");
$i=0;
while(<YFile>){
chop $_;
@Y_ary=split(",",$_);
$Y0[$i]=$Y_ary[0] ;
$Y1[$i]=$Y_ary[1] ;
$Y2[$i]=$Y_ary[2] ;
$Y3[$i]=$Y_ary[3] ;
$Y4[$i]=$Y_ary[4] ;
$Y5[$i]=$Y_ary[5] ;
$Y6[$i]=$Y_ary[6] ;
$i=$i+1;
}
#$i=0;
#foreach $Y_value (@Y1)
#{
# #print "Y0 array vlues:$Y_value counter $i ";
# print "$Y_value";
# $i++;
#}

##### Replace Y values to Y symbol  #####
open(Validation_data,"<$LC_LOG");
while(<Validation_data>){
foreach $Y_value_0 (@Y0)
{
s/,$Y_value_0 /,Y_0 /g ;
}
foreach $Y_value_1 (@Y1)
{
s/,$Y_value_1 /,Y_1 /g ;
}
foreach $Y_value_2 (@Y2)
{
s/,$Y_value_2 /,Y_2 /g ;
}
foreach $Y_value_3 (@Y3)
{
s/,$Y_value_3 /,Y_3 /g ;
}
foreach $Y_value_4 (@Y4)
{
s/,$Y_value_4 /,Y_4 /g ;
}
foreach $Y_value_5 (@Y5)
{
s/,$Y_value_5 /,Y_5 /g ;
}
foreach $Y_value_6 (@Y6)
{
s/,$Y_value_6 /,Y_6 /g ;
#print ",$Y_value_6 ";
}
print "$line ";
$line++;
print h2 $_;
}
close (h2);
rename("temp.log","interpolation.data");

$X0Y0=0; $X0Y1=0; $X0Y2=0; $X0Y3=0; $X0Y4=0; $X0Y5=0; $X0Y6=0;
$X1Y0=0; $X1Y1=0; $X1Y2=0; $X1Y3=0; $X1Y4=0; $X1Y5=0; $X1Y6=0;
$X2Y0=0; $X2Y1=0; $X2Y2=0; $X2Y3=0; $X2Y4=0; $X2Y5=0; $X2Y6=0;
$X3Y0=0; $X3Y1=0; $X3Y2=0; $X3Y3=0; $X3Y4=0; $X3Y5=0; $X3Y6=0;
$X4Y0=0; $X4Y1=0; $X4Y2=0; $X4Y3=0; $X4Y4=0; $X4Y5=0; $X4Y6=0;
$X5Y0=0; $X5Y1=0; $X5Y2=0; $X5Y3=0; $X5Y4=0; $X5Y5=0; $X5Y6=0;
$X6Y0=0; $X6Y1=0; $X6Y2=0; $X6Y3=0; $X6Y4=0; $X6Y5=0; $X6Y6=0;

open(h3,"<interpolation.data");
open(h2,">interpolation.result");
print "\n";
while(<h3>){
if (/$X_ary[0],Y_0/) { $X0Y0++ ; }
if (/$X_ary[0],Y_1/) { $X0Y1++ ; }
if (/$X_ary[0],Y_2/) { $X0Y2++ ; }
if (/$X_ary[0],Y_3/) { $X0Y3++ ; }
if (/$X_ary[0],Y_4/) { $X0Y4++ ; }
if (/$X_ary[0],Y_5/) { $X0Y5++ ; }
if (/$X_ary[0],Y_6/) { $X0Y6++ ; }
if (/$X_ary[1],Y_0/) { $X1Y0++ ; }
if (/$X_ary[1],Y_1/) { $X1Y1++ ; }
if (/$X_ary[1],Y_2/) { $X1Y2++ ; }
if (/$X_ary[1],Y_3/) { $X1Y3++ ; }
if (/$X_ary[1],Y_4/) { $X1Y4++ ; }
if (/$X_ary[1],Y_5/) { $X1Y5++ ; }
if (/$X_ary[1],Y_6/) { $X1Y6++ ; }
if (/$X_ary[2],Y_0/) { $X2Y0++ ; }
if (/$X_ary[2],Y_1/) { $X2Y1++ ; }
if (/$X_ary[2],Y_2/) { $X2Y2++ ; }
if (/$X_ary[2],Y_3/) { $X2Y3++ ; }
if (/$X_ary[2],Y_4/) { $X2Y4++ ; }
if (/$X_ary[2],Y_5/) { $X2Y5++ ; }
if (/$X_ary[2],Y_6/) { $X2Y6++ ; }
if (/$X_ary[3],Y_0/) { $X3Y0++ ; }
if (/$X_ary[3],Y_1/) { $X3Y1++ ; }
if (/$X_ary[3],Y_2/) { $X3Y2++ ; }
if (/$X_ary[3],Y_3/) { $X3Y3++ ; }
if (/$X_ary[3],Y_4/) { $X3Y4++ ; }
if (/$X_ary[3],Y_5/) { $X3Y5++ ; }
if (/$X_ary[3],Y_6/) { $X3Y6++ ; }
if (/$X_ary[4],Y_0/) { $X4Y0++ ; }
if (/$X_ary[4],Y_1/) { $X4Y1++ ; }
if (/$X_ary[4],Y_2/) { $X4Y2++ ; }
if (/$X_ary[4],Y_3/) { $X4Y3++ ; }
if (/$X_ary[4],Y_4/) { $X4Y4++ ; }
if (/$X_ary[4],Y_5/) { $X4Y5++ ; }
if (/$X_ary[4],Y_6/) { $X4Y6++ ; }
if (/$X_ary[5],Y_0/) { $X5Y0++ ; }
if (/$X_ary[5],Y_1/) { $X5Y1++ ; }
if (/$X_ary[5],Y_2/) { $X5Y2++ ; }
if (/$X_ary[5],Y_3/) { $X5Y3++ ; }
if (/$X_ary[5],Y_4/) { $X5Y4++ ; }
if (/$X_ary[5],Y_5/) { $X5Y5++ ; }
if (/$X_ary[5],Y_6/) { $X5Y6++ ; }
if (/$X_ary[6],Y_0/) { $X6Y0++ ; }
if (/$X_ary[6],Y_1/) { $X6Y1++ ; }
if (/$X_ary[6],Y_2/) { $X6Y2++ ; }
if (/$X_ary[6],Y_3/) { $X6Y3++ ; }
if (/$X_ary[6],Y_4/) { $X6Y4++ ; }
if (/$X_ary[6],Y_5/) { $X6Y5++ ; }
if (/$X_ary[6],Y_6/) { $X6Y6++ ; }
}
print "Slew-01 $X0Y0 $X0Y1 $X0Y2 $X0Y3 $X0Y4 $X0Y5 $X0Y6 \n" ;
print "Slew-02 $X1Y0 $X1Y1 $X1Y2 $X1Y3 $X1Y4 $X1Y5 $X1Y6 \n" ;
print "Slew-03 $X2Y0 $X2Y1 $X2Y2 $X2Y3 $X2Y4 $X2Y5 $X2Y6 \n" ;
print "Slew-04 $X3Y0 $X3Y1 $X3Y2 $X3Y3 $X3Y4 $X3Y5 $X3Y6 \n" ;
print "Slew-05 $X4Y0 $X4Y1 $X4Y2 $X4Y3 $X4Y4 $X4Y5 $X4Y6 \n" ;
print "Slew-06 $X5Y0 $X5Y1 $X5Y2 $X5Y3 $X5Y4 $X5Y5 $X5Y6 \n" ;
print "Slew-07 $X6Y0 $X6Y1 $X6Y2 $X6Y3 $X6Y4 $X6Y5 $X6Y6 \n" ;

printf ("Slew-01 %-5s %-5s %-5s %-5s %-5s %-5s %-5s \n", $X0Y0,$X0Y1,$X0Y2,$X0Y3,$X0Y4,$X0Y5,$X0Y6 ) ;
printf ("Slew-02 %-5s %-5s %-5s %-5s %-5s %-5s %-5s \n", $X1Y0,$X1Y1,$X1Y2,$X1Y3,$X1Y4,$X1Y5,$X1Y6 ) ;
printf ("Slew-03 %-5s %-5s %-5s %-5s %-5s %-5s %-5s \n", $X2Y0,$X2Y1,$X2Y2,$X2Y3,$X2Y4,$X2Y5,$X2Y6 ) ;
printf ("Slew-04 %-5s %-5s %-5s %-5s %-5s %-5s %-5s \n", $X3Y0,$X3Y1,$X3Y2,$X3Y3,$X3Y4,$X3Y5,$X3Y6 ) ;
printf ("Slew-05 %-5s %-5s %-5s %-5s %-5s %-5s %-5s \n", $X4Y0,$X4Y1,$X4Y2,$X4Y3,$X4Y4,$X4Y5,$X4Y6 ) ;
printf ("Slew-06 %-5s %-5s %-5s %-5s %-5s %-5s %-5s \n", $X5Y0,$X5Y1,$X5Y2,$X5Y3,$X5Y4,$X5Y5,$X5Y6 ) ;
printf ("Slew-07 %-5s %-5s %-5s %-5s %-5s %-5s %-5s \n", $X6Y0,$X6Y1,$X6Y2,$X6Y3,$X6Y4,$X6Y5,$X6Y6 ) ;

printf h2 ("        %-7s %-7s %-7s %-7s %-7s %-7s %-7s \n", "Load-1","Load-2","Load-3","Load-4","Load-5","Load-6","Load-7", ) ;
printf h2 ("Slew-01 %-7s %-7s %-7s %-7s %-7s %-7s %-7s \n", $X0Y0,$X0Y1,$X0Y2,$X0Y3,$X0Y4,$X0Y5,$X0Y6 ) ;
printf h2 ("Slew-02 %-7s %-7s %-7s %-7s %-7s %-7s %-7s \n", $X1Y0,$X1Y1,$X1Y2,$X1Y3,$X1Y4,$X1Y5,$X1Y6 ) ;
printf h2 ("Slew-03 %-7s %-7s %-7s %-7s %-7s %-7s %-7s \n", $X2Y0,$X2Y1,$X2Y2,$X2Y3,$X2Y4,$X2Y5,$X2Y6 ) ;
printf h2 ("Slew-04 %-7s %-7s %-7s %-7s %-7s %-7s %-7s \n", $X3Y0,$X3Y1,$X3Y2,$X3Y3,$X3Y4,$X3Y5,$X3Y6 ) ;
printf h2 ("Slew-05 %-7s %-7s %-7s %-7s %-7s %-7s %-7s \n", $X4Y0,$X4Y1,$X4Y2,$X4Y3,$X4Y4,$X4Y5,$X4Y6 ) ;
printf h2 ("Slew-06 %-7s %-7s %-7s %-7s %-7s %-7s %-7s \n", $X5Y0,$X5Y1,$X5Y2,$X5Y3,$X5Y4,$X5Y5,$X5Y6 ) ;
printf h2 ("Slew-07 %-7s %-7s %-7s %-7s %-7s %-7s %-7s \n", $X6Y0,$X6Y1,$X6Y2,$X6Y3,$X6Y4,$X6Y5,$X6Y6 ) ;

Usage:
perl analysis_consistancy.pl LC.log index_X index_Y


Generate index_X and index_Y :
grep index_1 a.lib | sort -u > index_X
grep index_2 a.lib | sort -u > index_Y
note: need to remove pre-fix and space ...etc

index_X :
0.002,0.0154552,0.062686,0.15288,0.293398,0.490561,0.75,

index_Y :
0.001,0.00106724,0.00130329,0.00175404,0.0024563,0.00344165,0.00473823
0.001,0.00109782,0.00144119,0.00209692,0.0031185,0.00455189,0.00643805
0.001,0.00110011,0.00145154,0.00212263,0.00316816,0.00463515,0.00656552
0.001,0.00110183,0.00145928,0.00214189,0.00320536,0.00469752,0.00666101
0.001,0.00110373,0.00146783,0.00216315,0.00324641,0.00476635,0.00676639

Results:
              Load-1  Load-2  Load-3  Load-4  Load-5  Load-6  Load-7
Slew-01 656       771       1032    1683    1802    1353    639  
Slew-02 599       714       919     1548    1475    878     330  
Slew-03 613       733       867     1295    982     365     205  
Slew-04 781       841       844     971     590     255     176  
Slew-05 800       809       632     535     344     196     167  
Slew-06 774       641       397     284     196     186     158  
Slew-07 1242     898       519     355     131     143     155  

沒有留言:

張貼留言

標籤