Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
measure-delay.awk
Package: ns2-aodv.rar [view]
Upload User: yjhhw123
Upload Date: 2014-05-29
Package Size: 1824k
Code Size: 1k
Category:
Linux Network
Development Platform:
Others
- BEGIN {
- #程式初始化,設定一變數以記錄目前最高處理封包的ID。
- highest_packet_id = 0;
- n=0;
- tm=0;
- }
- {
- action = $1;
- time = $2;
- flow_id = $4;
- packet_id = $6;
- #記錄目前最高的packet ID
- if ( packet_id > highest_packet_id )
- highest_packet_id = packet_id;
- #記錄封包的傳送時間
- if ( start_time[packet_id] == 0 )
- start_time[packet_id] = time;
- #記錄接收時間
- if ( flow_id == "AGT" && action != "d" ) {
- if ( action == "r" ) {
- end_time[packet_id] = time;
- }
- } else {
- #把不是flow_id="AGT"的封包或者是flow_id="AGT"但此封包被drop的時間設為-1
- end_time[packet_id] = -1;
- }
- }
- END {
- #當資料列全部讀取完後,開始計算有效封包的端點到端點延遲時間
- for ( packet_id = 0; packet_id <= highest_packet_id; packet_id++ ) {
- start = start_time[packet_id];
- end = end_time[packet_id];
- packet_duration = end - start;
- #只把接收時間大於傳送時間的記錄列出來
- if ( start < end ) {
- n += 1;
- tm += packet_duration;}
- }
- #输出平均传输时延
- printf("%fn", tm/n);
- }