BEGIN{ sim_end = 510; i=0; firstTime=0; simStartTime = 0; simEndTime = 0; while (i<=sim_end) {sec[i]=0; i+=1;}; NbSentPkt = 0.0; NbReceivedPkt = 0.0; } { if ($1=="s" && $4=="AGT" && $7=="cbr") { if (firstTime == 0 ) { simStartTime = int($2); firstTime = 1; }; simEndTime = int($2); NbSentPkt += 1; }; if ($1=="r" && $4=="AGT" && $7=="cbr") { sec[int($2)]+=$8; NbReceivedPkt += 1; }; } END{ i=0; totalNbBytes=0; #totalSimTime=0; while (i<=sim_end) {#print i " " sec[i]*8; if (sec[i]!= 0) { totalNbBytes+=sec[i]*8; #totalSimTime+=1; }; i+=1; }; print (totalNbBytes/(simEndTime - simStartTime + 1)) " " (NbReceivedPkt/NbSentPkt); #print totalNbBytes/totalSimTime; }