📄 appavgdelay.pl
字号:
# type: perl delay.pl <session list file> <trace file> > file$paraFile = $ARGV[0]; # the file store session info: flow ID, src node ID, dst node ID$infile = $ARGV[1]; # the trace file for outlink and inlink of each flowopen (PARA, "<$paraFile") || die "Can't open $paraFile";while (<PARA>) { $line = $_; @y = split(' '); $fid = $y[0]; $src = $y[1]; $dst = $y[2]; $totalDelay=0.0; $pktNum=0; %packet_hash=(); open (DATA, "<$infile") || die "Can't open $infile"; while (<DATA>) { $line = $_; @x = split(' '); if ($x[7] eq $fid) { $id = $x[10]; # use UDP/TCP packet sequence ID to identify the same packet in sender and receiver $SRC = $x[2]; $DST = $x[3]; if ( $SRC eq $src && $x[0] eq '+') { $packet_hash{$id} = $x[1]; # record sending time # print STDOUT "srcNum=$SRC SID=$id \n"; } elsif ($DST eq $dst && $x[0] eq 'r') { $latency = $x[1] - $packet_hash{$id}; # current recieving time - sending time in harsh table with same pkt ID. #print STDOUT "dstNum=$DST SID=$id \n"; $totalDelay = $totalDelay + $latency; $pktNum = $pktNum + 1; } } } #print STDOUT "totalDelay=$totalDelay, pktNum = $pktNum \n"; $AvgDelay = $totalDelay / $pktNum; print STDOUT "$fid $AvgDelay \n"; close DATA; } close PARA; exit(0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -