📄 wlan-chutil
字号:
#!/bin/tcsh## Channel utilization:# works on a trace file produced by ns# outputs idle time and the collision time on the channel between# the first and the (possibly unfinished) last transmission# for now: assumes that all MACs are on a single channelif ( $#argv != 1 ) then echo usage: echo " " $0 \<scenario\> exit 1endifset scenario = $1set tracefile = $scenario.trset outfile = $scenario.channelrm -f $outfileegrep "\-Nl MAC " $tracefile | gawk -v busy=0 -v outf=$outfile '\/^s/ { \ if (busy == 0) { \ if (last_eot != 0) { \ idle += ($3 - last_eot); \ } else { \ first_send = $3; \ } \ } \ if (busy == 1) { \ start_collision = $3; \ ++collisions; \ } \ print $3, busy >> outf; \ ++busy; \ print $3, busy >> outf; \} \/^x/ { \ print $3, busy >> outf; \ --busy; \ print $3, busy >> outf; \ if (busy < 0) { \ print "Fatal Error: EOT without send"; \ } \ if (busy == 1) { \ collision += ($3 - start_collision); \ } \ if (busy == 0) { \ last_eot = $3; \ ++total; \ } \} \END { \ if (busy > 1) { \ collision += ($3 - start_collision); \ } \ printf "Total time = %13.9f (%d)\n", ($3 - first_send), total; \ printf "Idle time = %13.9f \n", idle; \ printf "Collision time = %13.9f (%d)\n", collision, collisions; \}'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -