📄 wlan-bw
字号:
#!/bin/tcsh## works on a trace file produced by ns# outputsif ( $#argv != 3 ) then echo usage: echo " " $0 \<scenario\> \<flow id\> \<interval size\> exit 1endifset scenario = $1set flow = $2set interval = $3# base analysis on the AGT layerset layer = AGTset tracefile = $scenario.trset outfile = $scenario.$flow.bwrm -f $outfile# determine the first packet for a flow based on the first pkt# received at the agent layerset pkt = `egrep "^r .*\-Nl AGT .*\-If $flow " $tracefile | head -n 1 | gawk '{print $43;}'`# determine the receiver based on the first packet exchanged# the true receiver is the last node to receive the packetset rnode = `egrep "^r .*\-Nl $layer .*\-If $flow .*\-Ii $pkt " $tracefile | tail -1 | gawk '{print $9;}'`# determine the time the first packet was sentset start = `egrep "^s .*\-Nl $layer .*\-If $flow .*\-Ii $pkt " $tracefile | head -1 | gawk '{print $3;}'`# use number of bytes received over the last interval to calc# interval b/wegrep "^r .*\-Ni $rnode .*\-Nl $layer .*\-If $flow " $tracefile | \ gawk -v start=$start -v base=$start -v step=$interval -v outfile=$outfile '{ \ time = $3; \ while (time > base) { \ bw = bytes/step; \ if (max < bw) max = bw; \ printf "%.9f %.9f\n", base, bw >> outfile; \ base += step; \ bytes = 0; \ } \ total_bytes += $39; \ bytes += $39; \ } END { \ step -= (base - time); \ bw = bytes/step; \ if (max < bw) max = bw; \ printf "%.9f %.9f\n", time, bw >> outfile; \ if (total_bytes) \ printf "Total B/w = %.3fKB/s\n", ((total_bytes/1024.0)/(time-start)); \ else \ printf "Total B/w = 0.0KB/s\n"; \ printf "Max B/w = %.3fKB/s\n", (max/1024.0); \ }'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -