1 BEGIN { 2 # we need to know (usual) packet size to convert byte numbers 3 # to packet numbers 4 if (packetsize <= 0) 5 packetsize = 512 6 } 7 $5 !~ /[SR]/ { 8 # print out per-packet data in the form: 9 # <packet #> 10 # <start sequence #> 11 # <1st send time> 12 # <last send time> 13 # <1st ack time> 14 # <last ack time> 15 # <# sends> 16 # <# acks> 17 18 n = split ($1,t,":") 19 tim = t[1]*3600 + t[2]*60 + t[3] 20 if ($6 != "ack") { 21 i = index($6,":") 22 strtSeq = substr($6,1,i-1) 23 id = 1.5 + (strtSeq - 1) / packetsize 24 id -= id % 1 25 if (maxId < id) 26 maxId = id 27 if (firstSend[id] == 0) { 28 firstSend[id] = tim 29 seqNo[id] = strtSeq 30 } 31 lastSend[id] = tim 32 timesSent[id]++ 33 totalPackets++ 34 } else { 35 id = 1 + ($7 - 2) / packetsize 36 id -= id % 1 37 timesAcked[id]++ 38 if (firstAck[id] == 0) 39 firstAck[id] = tim 40 lastAck[id] = tim 41 totalAcks++ 42 } 43 } 44 END { 45 print "# " maxId " chunks. " totalPackets " packets sent. " \ 46 totalAcks " acks." 47 # for packets that were implicitly acked, make the ack time 48 # be the ack time of next explicitly acked packet. 49 for (i = maxId-1; i > 0; --i) 50 while (i > 0 && firstAck[i] == 0) { 51 lastAck[i] = firstAck[i] = firstAck[i+1] 52 --i 53 } 54 tzero = firstSend[1] 55 for (i = 1; i <= maxId; i++) 56 printf "%d\t%d\t%.2f\t%.2f\t%.2f\t%.2f\t%d\t%d\n",\ 57 i, seqNo[i], \ 58 firstSend[i] - tzero, lastSend[i] - tzero,\ 59 firstAck[i] - tzero, lastAck[i] - tzero,\ 60 timesSent[i], timesAcked[i] 61 } 62