# This prints the Seqnos, and the fraction of packets with that Seqno. # Input file: ########################################### # Distribution of Seqnos, 100 seqnos per bins # 0 to 99: fraction 0.111 number 9384 # 100 to 199: fraction 0.095 number 8101 # 200 to 299: fraction 0.095 number 8021 ########################################### { if (NR==1) { thisbin = 0; binsize = 0; maxbin = 1000; state = 0; firstbin = -1; } if (binsize > 0) { if ($2=="to"&&$4=="seqnos:") { bin = $3; frac = $6; number = $8; ##printf "line: state: %d bin: %d number: %d\n", state, bin, number; aveseqno = bin - halfbin; if (state =="1" && seen[seqno] != 1) { num[aveseqno] = number; seen[aveseqno] = 1; } if (state == 2) { if (num[aveseqno] > 0) secondnum = number - num[aveseqno]; else secondnum = number; if (secondnum < 0) secondnum = 0; for (i=thisbin; i lastbin) { final[aveseqno] = secondnum; total += secondnum; lastbin = aveseqno; } thisbin = bin + binsize; }} } if ($1=="Distribution"&&$3=="Seqnos,") { binsize = $4; halfbin = binsize/2; if (binsize = 1) halfbin = 0; else halfbin = binsize/2; ++ state; } } END{ for (i=thisbin; i<=maxbin; i += binsize) { aveSeqno = i - halfbin; final[aveSeqno]=0; lastbin = aveSeqno; } printf "0 %d\n", final[0]; firstbin = binsize - halfbin - 1; for (i = firstbin; i <= lastbin; i += binsize) { ## printf "%d %4.3f\n", i + 1, final[i]; if (total > 0) printf "%d %7.6f\n", i + 1, final[i]/total; } }