📄 throughput.pl
字号:
# type: perl throughput.pl <trace file> <required node> <granlarity> > output file$infile=$ARGV[0];$tonode=$ARGV[1];$granularity=$ARGV[2];#we compute how many bytes were transmitted during time interval specified#by granularity parameter in seconds$sum=0;$clock=0; open (DATA,"<$infile") || die "Can't open $infile $!"; while (<DATA>) { @x = split(' ');#column 1 is time if ($x[1]-$clock <= $granularity){#checking if the event corresponds to a reception if ($x[0] eq 'r') { #checking if the destination corresponds to arg 1if ($x[3] eq $tonode) { #checking if the packet type is TCPif ($x[4] eq 'tcp') { $sum=$sum+$x[5];}}}}else{ $throughput=$sum/$granularity; print STDOUT "$x[1] $throughput\n"; $clock=$clock+$granularity; $sum=0;} } $throughput=$sum/$granularity; print STDOUT "$x[1] $throughput\n"; $clock=$clock+$granularity; $sum=0; close DATA;exit(0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -