NS2网络模拟(2)-丢包率
2013-07-23 17:04
465 查看
1: #NS2_有线部分\LossRate.awk
2:
3: BEGIN {
4: #Initialize the variable
5: Lost = 0; #the Sum of Lost packet
6: Send = 0; #the Sum of Send packet
7: }
8:
9: {
10: #Event Abbreviation Type Value
11: #%g %d %d %s %d %s %d %d.%d %d.%d %d %d
12: #Normal Event
13: #r: Receive
14: #d: Drop
15: #e: Error
16: #+: Enqueue
17: #-: Dequeue
18: #double Time
19: #int (Link-layer) Source Node
20: #int (Link-layer) Destination Node
21: #string Packet Name
22: #int Packet Size
23: #string Flags
24: #int Flow ID
25: #int (Network-layer) Source Address
26: #int Source Port
27: #int (Network-layer) Destination Address
28: #int Destination Port
29: #int Sequence Number
30: #int Unique Packet ID
31:
32: #Evaluate the fields to new viariables
33: EVENT = $1;
34: TIME = $2;
35: SRCNODE = $3
36: DSTNODE = $4;
37: PKTNAME = $5;
38: PKTSIZE = $6;
39: FLAGS = $7;
40: FLOWID = $8;
41: SRCADDPORT = $9;
42: DSTADDPORT = $10;
43: SEQNO = $11;
44: PKTID = $12;
45:
46: #Count up the packets send from n1
47: if (EVENT == "+" && SRCNODE == 1 && DSTNODE == 0 && PKTNAME == "tcp")
48: Send ++;
49: #Count up the drop packet
50: if (EVENT == "d" && SRCNODE == 0 && DSTNODE == 1 && PKTNAME == "ack")
51: Lost ++;
52: }
53:
54: END {
55: printf("TCP:number of packets send: %d lost: %d\n", Send, Lost);
56: printf("TCP:the loss rate of packets: %.5f\n", Lost/Send);
57: }
相关文章推荐
- NS2网络模拟(2)-丢包率
- NS2网络模拟(2)-丢包率
- NS2网络模拟(2)-丢包率
- NS2网络模拟(1)-延迟
- NS2网络模拟(5)-homework01.tcl
- NS2网络模拟(1)-延迟
- NS2网络模拟(4)-吞吐率图
- NS2网络模拟(7)-homework03.tcl
- NS2网络模拟(3)-吞吐率
- NS2网络模拟(3)-吞吐率
- NS2网络模拟(6)-homework02.tcl
- NS2网络模拟计算吞吐量
- NS2中无线网络模拟之三(AODV路由分析4)
- NS2网络模拟(4)-吞吐率图
- ns2无线网络模拟出现的错误和调试-转自csdn响亮空间
- 利用NS2进行无线网络模拟
- NS2网络模拟(5)-homework01.tcl
- NS2网络模拟(1)-延迟
- NS2网络模拟(5)-homework01.tcl
- NS2中无线网络模拟之三(AODV路由分析2)