NS2_awk-throughput1_upstream10/downstream10

|

BEGIN {
 n0=0;
 n1=0;
 n2=0;
 n3=0;
 n4=0;
 n5=0;
 n6=0;
 n7=0;
 n8=0;
 n9=0;
 
 total0 = 0;
 total1 = 0;
 total2 = 0;
 total3 = 0;
 total4 = 0;
 total5 = 0;
 total6 = 0;
 total7 = 0;
 total8 = 0;
 total9 = 0;
 throughput0=0;
 throughput1=0;
 throughput2=0;
 throughput3=0;
 throughput4=0;
 throughput5=0;
 throughput6=0;
 throughput7=0;
 throughput8=0;
 throughput9=0;
 
 SIMUL_TIME=500;
 AWK_INTERVAL=400;
}

{
 
  if ( ($1 =="r") && ($5 =="tcp") && ($4 =="0") && ($3 ==nn)) {
   if (n0 == 0) start0 = $2;
   n0++;
   total0 += $6 * 8;
   end0 = $2;
  }
  if (1<nn)
  {
  if ( ($1 =="r") && ($5 =="tcp") && ($4 =="1") && ($3 ==nn)) {
   if (n1 == 0) start1 = $2;
   n1++;
   total1 += $6 * 8;
   end1 = $2;
  }
  if (2<nn)
  {
  if ( ($1 =="r") && ($5 =="tcp") && ($4 =="2") && ($3 ==nn)) {
   if (n2 == 0) start2 = $2;
   n2++;
   total2 += $6 * 8;
   end2 = $2;
  }
  if (3<nn)
  {
  if ( ($1 =="r") && ($5 =="tcp") && ($4 =="3") && ($3 ==nn)) {
   if (n3 == 0) start3 = $2;
   n3++;
   total3 += $6 * 8;
   end3 = $2;
  }
  if (4<nn)
  {
  if ( ($1 =="r") && ($5 =="tcp") && ($4 =="4") && ($3 ==nn)) {
   if (n4 == 0) start4 = $2;
   n4++;
   total4 += $6 * 8;
   end4 = $2;
  }
  if (5<nn)
  {
  if ( ($1 =="r") && ($5 =="tcp") && ($4 =="5") && ($3 ==nn)) {
   if (n5 == 0) start5 = $2;
   n5++;
   total5 += $6 * 8;
   end5 = $2;
  }
  if (6<nn)
  {
  if ( ($1 =="r") && ($5 =="tcp") && ($4 =="6") && ($3 ==nn)) {
   if (n6 == 0) start6 = $2;
   n6++;
   total6 += $6 * 8;
   end6 = $2;
  }
  if (7<nn)
  {
  if ( ($1 =="r") && ($5 =="tcp") && ($4 =="7") && ($3 ==nn)) {
   if (n7 == 0) start7 = $2;
   n7++;
   total7 += $6 * 8;
   end7 = $2;
  }
  if (8<nn)
  {
  if ( ($1 =="r") && ($5 =="tcp") && ($4 =="8") && ($3 ==nn)) {
   if (n8 == 0) start8 = $2;
   n8++;
   total8 += $6 * 8;
   end8 = $2;
  }
  if (9<nn)
  {
   if ( ($1 =="r") && ($5 =="tcp") && ($4 =="9") && ($3 ==nn)) {
   if (n9 == 0) start9 = $2;
   n9++;
   total9 += $6 * 8;
   end9 = $2;
  }
  }
  }
  }
  }
  }
  }
  }
  }
  }
  
}

END {
  throughput0 = (total0)/ ( (1000) * 500 );
  throughput1 = (total1)/ ( (1000) * 500 );
   throughput2 = (total2)/ ( (1000) * 500 );
   throughput3 = (total3)/ ( (1000) * 500 );
   throughput4 = (total4)/ ( (1000) * 500 );
   throughput5 = (total5)/ ( (1000) * 500 );
   throughput6 = (total6)/ ( (1000) * 500 );
   throughput7 = (total7)/ ( (1000) * 500 );
   throughput8 = (total8)/ ( (1000) * 500 );
  throughput9 = (total9)/ ( (1000) * 500 );
 #Bandwidth 1Mbps = 1000Kbps

 print throughput0,"\t",total0;
 print throughput1,"\t",total1;
 print throughput2,"\t",total2;
 print throughput3,"\t",total3;
 print throughput4,"\t",total4;
 print throughput5,"\t",total5;
 print throughput6,"\t",total6;
 print throughput7,"\t",total7;
 print throughput8,"\t",total8;
 print throughput9,"\t",total9;
 print "========================================================="
}


And