$start_analysis=0; $i=0; $total_slew=0; $total_delay=0;
open(h2,"results.log");
open(h3,"sort.log");
open(XFile,"<$index_X");
while(<XFile>){
chop $_;
@M_DATA=split(" ",$_);
if($start_analysis eq "1"){
@slew[$i]=($M_DATA[2]-$M_DATA[1])*2 ;
@delay[$i]=($M_DATA[4]-$M_DATA[3]) ;
$total_slew=$total_slew+@slew[$i];
$total_delay=$total_delay+@delay[$i];
print h2 "The $i slew is $slew[$i] \n";
print h2 "The $i delay is $delay[$i] \n";
print h2 "The total_slew is $total_slew \n";
print h2 "The $i delay is $total_delay \n";
$i++;
}
if(/^index/){
$start_analysis="1"'}
}
## Sort slew/delay data
@sort_slew=sort {$a <=> $b} @slew;
@sort_delay=sort {$a <=> $b} @delay;
print h3 "print out sort slew data \n";
for ($j=0; $j<=$#sort_slew; $j++) {
print h3 "$sort_slew[$j]\n";
}
print h3 "print out sort delay data \n";
for ($j=0; $j<=$#sort_delay; $j++) {
print h3 "$sort_delay[$j]\n";
}
$average_slew=$total_slew/($i+1);
$average_delay=$total_delay/($i+1);
print h2 "The average slew is $average_slew \n";
print h2 "The average delay is $average_delay \n";
foreach $slewdata (@slew) {
if($slewdata>$average_slew){
$sum_late_slew=$sum_late_slew+(($slewdata-$average_slew)**2);
$late_slew_index++;}
if($slewdata<$average_slew){
$sum_early_slew=$sum_early_slew+(($average_slew-$slewdata)**2);
$early_slew_index++;}
}
print h2 "The late slew index is $late_slew_index \n";
print h2 "The early slew index is $early_slew_index \n";
$slew_late_sigma=sqrt($sum_late_slew/($late_slew_index));
$slew_early_sigma=sqrt($sum_early_slew/($early_slew_index));
print h2 "The late slew sigma is $slew_late_sigma \n";
print h2 "The early slew sigma is $slew_early_sigma \n";
沒有留言:
張貼留言