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. [RxJS] Replace zip with combineLatest when combining sources of data

    This lesson will highlight the true purpose of the zip operator, and how uncommon its use cases are. ...

  2. gdb常用调试命令以及多线程堆栈的查看

    GDB是GNU开源组织发布的一个强大的UNIX下的程序调试工具.或许,各位比较喜欢那种图形界面方式的,像VC.BCB等IDE的调试,但如果你是在UNIX平台下做软件,你会发现GDB这个调试工具有比VC ...

  3. ZOJ Special AC String 水

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3702 题目大意: 对于给定的一个字符串,满足如下要求输出AC,否则WA(好吧我 ...

  4. 终端复用工具tmux的使用

    tmux的作用在于终端复用. 1. 在server上启动一个bash.并在里面执行tmux 2. 通过ssh远程登录server,执行tmux attach,就会切换到server上的那个bash中, ...

  5. ios开发之级联菜单(两个tableView实现)

    一:在ios项目实际开发中经常会看到级联菜单的效果:如图:点击左侧菜单,右侧菜单刷新数据.此篇用两个tableView来实现如图效果: 二:代码: 1:构造数据模型:利用kvc快速构建数据模型 #im ...

  6. golang 操作 Redis & Mysql & RabbitMQ

    golang 操作 Redis & Mysql & RabbitMQ Reids 安装导入 go get github.com/garyburd/redigo/redis import ...

  7. 前端js实现打印excel表格

    产品原型: 图片.png 功能需求:点击导出考勤表格按钮,会自动下载成Excel格式 图片.png 图片.png jsp页面代码: <div class="tools"> ...

  8. [Node.js] Test Node RESTful API with Mocha and Chai

    In this lesson, we will use Chai's request method to test our Node application's API responses.By th ...

  9. [Ramda] Compose lenses

    We can compose lenses to get value: const addrs = [{street: '99 Walnut Dr.', zip: '04821'}, {street: ...

  10. MySQL 监控-innotop

    innotop 编写者Balon Schwartz,<高性能MySQL>的作者之一. innotop的作用为实时地展示服务器正在发生的事情,监控innodb,监控多个MySQL实例,是一款 ...