NS2网络模拟(1)-延迟
1: #NS2_有线部分\EndDelay.awk
2:
3: BEGIN {
4: #Initialize the variable
5: MaxID = 0;
6: i = 0;
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: #Record the maxmum
47: if (PKTID > MaxID)
48: MaxID = PKTID;
49:
50: #Record the transmitter time
51: if (StartTime[PKTID] == 0)
52: StartTime[PKTID] = TIME;
53:
54:
55: if (EVENT == "r" && FLOWID == 1)
56: {
57: # printf("after: %s\t%d\t%s\n", EVENT, FLOWID, TIME);
58: EndTime[PKTID] = TIME;
59: # printf("%g %d %d %s %d %s %d %d.%d %d.%d %d %d\n", EVENT, TIME, FLOWID, PKTID);
60: # printf("after: %s %d %s %d\n", EVENT, FLOWID, EndTime[PKTID], PKTID);
61: # if (EVENT == "r")
62: # {
63: # EndTime[PKTID] = TIME;
64: # }
65:
66: }
67: else
68: {
69: EndTime[PKTID] = -1;
70:
71: }
72:
73:
74: }
75:
76: END {
77: for (PKTID = 0; PKTID <= MaxID; PKTID ++)
78: {
79: Start = StartTime[PKTID];
80: End = EndTime[PKTID];
81: Delay = End - Start;
82: if (Delay >= 0)
83: printf("%f\t%f\n", Start, Delay);
84: # packet_duration = EndTime[PKTID] - StartTime[PKTID];
85:
86: # printf("%f\t%f\n", start, packet_duration);
87: }
88: }
89:
NS2网络模拟(1)-延迟的更多相关文章
- NS2网络模拟(7)-homework03.tcl
1: #NS2_有线部分\homework03.tcl 2: 3: #Create a simulator object 4: set ns [new Simulator] 5: 6: #Define ...
- NS2网络模拟(6)-homework02.tcl
1: #NS2_有线部分\homework02.tcl 2: 3: #Create a simulator object 4: set ns [new Simulator] 5: 6: #Define ...
- NS2网络模拟(5)-homework01.tcl
1: #NS2_有线部分\homework01.tcl 2: 3: #创建两个结点,深圳到北京的TCP连接,图形将数据显示出来,计算吞吐率,画图分析 4: #tcp上层用ftp 5: #udp上层用c ...
- NS2网络模拟(4)-吞吐率图
1: #NS2_有线部分\ForGnuplot.plot 2: 3: #gnuplot> 4: #set xtics 0, 1, 10 5: set grid 6: set xrange [0: ...
- NS2网络模拟(3)-吞吐率
1: #NS2_有线部分\Throughput.awk 2: 3: BEGIN { 4: #Initialize the variable 5: init = 0; 6: i = 0; 7: } 8: ...
- NS2网络模拟(2)-丢包率
1: #NS2_有线部分\LossRate.awk 2: 3: BEGIN { 4: #Initialize the variable 5: Lost = 0; #the Sum of Lost pa ...
- Facebook 网络模拟工具 ATC部署及使用
废话引用: Facebook此前开源了增强网络流量控制工具 ATC,能利用WiFi网络模拟各种移动网络,测试智能手机和APP在不同国家地区和应用环境下的性能表现.ATC能够模拟2G.2.5G(Edge ...
- 与NS2一起度过第一个圣诞夜!(NS2入门学习参考资料)
Merry xmas! 安装好NS2后正式开始学习NS2啦,先转发一哥们的博客内容,慢慢看! 一). NS常用基本网站 1. 寻求问题答案最好的地方. http:/ ...
- Facebook网络模拟测试工具ATC使用
Facebook在其工程博客(原文)上宣布开源移动网络测试工具Augmented Traffic Control(ATC),我迅速试用了一番,非常不错,对手游或者其他APP的调试和测试都非常有帮助,介 ...
随机推荐
- C#的Timer(很多相关文章)
再C#里现在有3个Timer类: System.Windows.Forms.Timer System.Threading.Timer System.Timers.Timer 这三个Timer我想大家对 ...
- php用两个栈来实现队列
php用两个栈来实现队列 一.总结 我主要的问题是不知道的是题目描述,题目和贵的代码之间的关系,以及返回值 思路:A栈做入队操作,B栈做出队操作,入队的时候元素直接入A,出队的时候判断B栈是否为空,如 ...
- 【23.33%】【codeforces 557B】Pasha and Tea
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- 【u121】教主的花园
Time Limit: 1 second Memory Limit: 128 MB [问题描述] 教主有着一个环形的花园,他想在花园周围均匀地种上n棵树,但是教主花园的土壤很特别,每个位置适合种的树都 ...
- Java链接Redis时出现 “ERR Client sent AUTH, but no password is set” 异常的原因及解决办法
Java链接Redis时出现 "ERR Client sent AUTH, but no password is set" 异常的原因及解决办法 [错误提示] redis.clie ...
- php-post模拟登录,同步登录(摘自网络)
这也是个老生常谈的话题了,上午花了点时间把这个问题整理了一下. 一般来说用PHP来模拟post提交数据有三种方法,file_get_contents.curl和socket. 写了个公用函数,专门用来 ...
- [Vue] Update Attributes, Classes and Styles in Vue.js with v-bind
Use v-bind:class and v-bind:style to compute html classes and inline styles from component data. Vue ...
- Gibbs 采样定理的若干证明
坐标平面上的三点,A(x1,y1),B(x1,y2),C(x2,y1),假设有概率分布 p(x,y)(P(X=x,Y=y) 联合概率),则根据联合概率与条件概率的关系,则有如下两个等式: {p(x1, ...
- C++网络编程方面的开源项目
Webbench是一个在linux下使用的非常简单的网站压测工具.它使用fork()模拟多个客户端同时访问我们设定的URL,测试网站在压力下工作的性能,最多可以模拟3万个并发连接去测试网站的负载能力. ...
- head first c 笔记<3> 之做一件事并把它做好
1.标准输入.输出与重定向 scanf()和printf()分别为标准输入输出.默认的会从键盘得到数据,在显示器输出数据,是fscanf()和fprintf()函数的特例. 我们也能够用重定向来改变默 ...