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)-延迟的更多相关文章

  1. NS2网络模拟(7)-homework03.tcl

    1: #NS2_有线部分\homework03.tcl 2: 3: #Create a simulator object 4: set ns [new Simulator] 5: 6: #Define ...

  2. NS2网络模拟(6)-homework02.tcl

    1: #NS2_有线部分\homework02.tcl 2: 3: #Create a simulator object 4: set ns [new Simulator] 5: 6: #Define ...

  3. NS2网络模拟(5)-homework01.tcl

    1: #NS2_有线部分\homework01.tcl 2: 3: #创建两个结点,深圳到北京的TCP连接,图形将数据显示出来,计算吞吐率,画图分析 4: #tcp上层用ftp 5: #udp上层用c ...

  4. NS2网络模拟(4)-吞吐率图

    1: #NS2_有线部分\ForGnuplot.plot 2: 3: #gnuplot> 4: #set xtics 0, 1, 10 5: set grid 6: set xrange [0: ...

  5. NS2网络模拟(3)-吞吐率

    1: #NS2_有线部分\Throughput.awk 2: 3: BEGIN { 4: #Initialize the variable 5: init = 0; 6: i = 0; 7: } 8: ...

  6. NS2网络模拟(2)-丢包率

    1: #NS2_有线部分\LossRate.awk 2: 3: BEGIN { 4: #Initialize the variable 5: Lost = 0; #the Sum of Lost pa ...

  7. Facebook 网络模拟工具 ATC部署及使用

    废话引用: Facebook此前开源了增强网络流量控制工具 ATC,能利用WiFi网络模拟各种移动网络,测试智能手机和APP在不同国家地区和应用环境下的性能表现.ATC能够模拟2G.2.5G(Edge ...

  8. 与NS2一起度过第一个圣诞夜!(NS2入门学习参考资料)

    Merry xmas! 安装好NS2后正式开始学习NS2啦,先转发一哥们的博客内容,慢慢看! 一). NS常用基本网站         1. 寻求问题答案最好的地方.           http:/ ...

  9. Facebook网络模拟测试工具ATC使用

    Facebook在其工程博客(原文)上宣布开源移动网络测试工具Augmented Traffic Control(ATC),我迅速试用了一番,非常不错,对手游或者其他APP的调试和测试都非常有帮助,介 ...

随机推荐

  1. Pandoc —— 标记语言转换工具(中文乱码问题)

    今次毕业设计,来个逼格高的,用 latex 编写.谁曾想,学院首先要收一份 word 版的.辣么多的 latex 公式如何转呀. Pandoc 是由 John MacFarlane 开发的标记语言转换 ...

  2. signature.html

    原文网址:http://www.youdzone.com/signature.html   阮一峰:http://www.ruanyifeng.com/blog/2011/08/what_is_a_d ...

  3. eclipse设置jvm

    设置参数: -Xverify:none -Xms512m -Xmx512m -Xmn128m -XX:PermSize=96m -XX:MaxPermSize=96m -XX:+UseConcMark ...

  4. [Docker] Build Your Own Custom Docker Image

    In this lesson we will cover how to build your own custom Docker image from scratch. We'll walk thro ...

  5. Bootstrapbutton

    Bootstrap 提供了一些选项来定义button的样式,详细例如以下表所看到的: 下面样式可用于<a>, <button>, 或 <input> 元素上: 类 ...

  6. eclipse 远程debug tomcat web项目

    1.首先须要在linux系统tomcat/bin文件夹下配置catalina.sh这个文件里添加: CATALINA_OPTS="-Xdebug  -Xrunjdwp:transport=d ...

  7. nas docker xunlei

    http://bbs.xunlei.com/thread-389018-1-1.html 首先,启动远程服务,找到你的设备IP,在浏览器里输入以下地址,host换成你设备的IP http://host ...

  8. Android自定义控件View(二)继承控件

    在前一篇博客中学习了Android自定义控件View的流程步骤和注意点,不了解的童鞋可以参考Android自定义控件View(一).这一节开始学习自定义控件View(二)之继承系统已有的控件.我们来自 ...

  9. 《写给大忙人看的Java SE 8》——Java8新特性总结

    阅读目录 接口中的默认方法和静态方法 函数式接口和Lambda表达式 Stream API 新的日期和时间 API 杂项改进 参考资料 回到顶部 接口中的默认方法和静态方法 先考虑一个问题,如何向Ja ...

  10. android 连接USB按power键锁屏2声锁屏音

    alps\frameworks\base\packages\Keyguard\src\com\android\keyguard\KeyguardViewMediator.java #1384 行左右: ...