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: 
				
时间: 2024-09-29 13:15:01

NS2网络模拟(1)-延迟的相关文章

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

1: #NS2_有线部分\homework03.tcl 2: 3: #Create a simulator object 4: set ns [new Simulator] 5: 6: #Define different colors for data flows 7: $ns color 1 Blue 8: $ns color 2 Red 9: 10: #Open the nam trace file 11: set nf [open szsh.nam w] 12: $ns namtrace-

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

1: #NS2_有线部分\homework02.tcl 2: 3: #Create a simulator object 4: set ns [new Simulator] 5: 6: #Define different colors for data flows 7: $ns color 1 Blue 8: $ns color 2 Red 9: 10: #Open the nam trace file 11: set nf [open szsh.nam w] 12: $ns namtrace-

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

1: #NS2_有线部分\homework01.tcl 2: 3: #创建两个结点,深圳到北京的TCP连接,图形将数据显示出来,计算吞吐率,画图分析 4: #tcp上层用ftp 5: #udp上层用cbr 6: #Create a simulator object 7: set ns [new Simulator] 8: 9: set nf [open SZ2BJ.nam w] 10: $ns namtrace-all $nf 11: 12: set nd [open SZ2BJ.tr w] 1

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

1: #NS2_有线部分\ForGnuplot.plot 2: 3: #gnuplot> 4: #set xtics 0, 1, 10 5: set grid 6: set xrange [0:10] 7: set yrange [0:1000] 8: set key top left set key bottom right 9: set key box 10: set title "TCP Throughput" 11: set xlabel "Time(s)&qu

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

1: #NS2_有线部分\Throughput.awk 2: 3: BEGIN { 4: #Initialize the variable 5: init = 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:

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

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 Even

NS2

NS是一种针对网络技术的源代码公开的.免费的软件模拟平台,研究人员使用它可以很容易的进行网络技术的开发,而且发展到今天,它所包含的模块已经非常丰富,几乎涉及到了网络技术的所有方面.所以,NS成了目前学术界广泛使用的一种网络模拟软件.在每年国内外发表的有关网络技术的学术论文中,利用NS给出模拟结果的文章最多,通过这种方法得出的研究结果也是被学术界所普遍认可的,此外,NS也可作为一种辅助教学的工具,已被广泛应用在了网络技术的教学方面.因此,目前在学术界和教育界,有大量的人正在使用或试图使用NS. 然

如何实现1080P延迟低于500ms的实时超清直播传输技术

再来当一次技术搬运工,内容来自高可用框架,学霸君工程师袁荣喜的如何实现1080P延迟低于500ms的实时超清直播传输技术.        导语:视频直播是很多技术团队及架构师关注的问题,在实时性方面,大部分直播是准实时的,存在 1-3 秒延迟.本文由袁荣喜向「高可用架构」投稿,介绍其将直播延迟控制在 500ms 的背后的实现.          袁荣喜,学霸君工程师,2015 年加入学霸君,负责学霸君的网络实时传输和分布式系统的架构设计和实现,专注于基础技术领域,在网络传输.数据库内核.分布式系

ios-需要在IOS中设置延迟功能

问题描述 需要在IOS中设置延迟功能 需要一个延时器,进行23秒的延迟然后执行函数.应该怎么实现?用不用NSTimer? 解决方案 performSelector: withObject: afterDelay: 解决方案二: 简单点的话,使用performSelector: withObject: afterDelay: 方法 [self performSelector:@selector(delayMethod:) withObject:nil afterDelay:23];