当前位置: 首页>>代码示例>>Python>>正文


Python Packet.arrival_time_ms方法代码示例

本文整理汇总了Python中packet.Packet.arrival_time_ms方法的典型用法代码示例。如果您正苦于以下问题:Python Packet.arrival_time_ms方法的具体用法?Python Packet.arrival_time_ms怎么用?Python Packet.arrival_time_ms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在packet.Packet的用法示例。


在下文中一共展示了Packet.arrival_time_ms方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_average_bitrate_two_packets

# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import arrival_time_ms [as 别名]
 def test_average_bitrate_two_packets(self):
     for i in range(10):
         packet_size_bytes = random.uniform(1.0, 8000.0)
         delay_ms = random.uniform(10.0, 300.0)
         gap_ms = random.uniform(10.0, 50.0)
         packet1 = Packet(1, 0.0, packet_size_bytes)
         packet2 = Packet(2, gap_ms, packet_size_bytes)
         packet1.arrival_time_ms = delay_ms
         packet2.arrival_time_ms = gap_ms + delay_ms
         self.assertNear(average_bitrate_kbps([packet1, packet2]), 8.0 * packet_size_bytes / gap_ms, 0.001)
开发者ID:cesar-ilharco,项目名称:rmcat_evaluation,代码行数:12,代码来源:bwe_utils_unittest.py

示例2: test_average_bitrate_single_packet

# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import arrival_time_ms [as 别名]
 def test_average_bitrate_single_packet(self):
     for i in range(10):
         packet_size_bytes = random.uniform(1.0, 8000.0)
         delay_ms = random.uniform(10.0, 300.0)
         packet = Packet(1, 0.0, packet_size_bytes)
         packet.arrival_time_ms = delay_ms
         self.assertEqual(average_bitrate_kbps([packet]), 8.0 * packet_size_bytes / delay_ms)
开发者ID:cesar-ilharco,项目名称:rmcat_evaluation,代码行数:9,代码来源:bwe_utils_unittest.py

示例3: test_receiving_rate_kbps_single_packet

# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import arrival_time_ms [as 别名]
 def test_receiving_rate_kbps_single_packet(self):
     payload_sizes_bytes = [0.0, 500.0, 1200.0] # Empty or non-empty packet.
     for payload_size_bytes in payload_sizes_bytes:
         # id and send_time don't matter here.
         packet = Packet(None, None, payload_size_bytes)
         for i in range(10):
             packet.arrival_time_ms = i
             time_window_ms = random.uniform(100.0, 1000.0)
             self.assertEqual(receiving_rate_kbps([packet], time_window_ms),
                             8.0 * packet.payload_size_bytes / time_window_ms)
开发者ID:cesar-ilharco,项目名称:rmcat_evaluation,代码行数:12,代码来源:bwe_utils_unittest.py

示例4: test_loss_ratio_gap_packets

# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import arrival_time_ms [as 别名]
    def test_loss_ratio_gap_packets(self):
        packets = []
        for i in range(10):
            # Only id and arrival time matter here
            packet = Packet(i, None, None)
            packet.arrival_time_ms = 10.0 * i
            packets.append(packet)

        for i in range(20, 30):
            # Only id and arrival time matter here
            packet = Packet(i, None, None)
            packet.arrival_time_ms = 10.0 * i 
            packets.append(packet)

        # Short time windows won't trigger loss computation.
        for t in range(0, 200, 10):
            self.assertEqual(loss_ratio(packets, t), 0.0)

        for i in range(10):
            time_window_ms = 200 + 10*i
            loss = 1.0 - float(11 + i)/(21 + i)
            self.assertEqual(loss_ratio(packets, time_window_ms), loss)
开发者ID:cesar-ilharco,项目名称:rmcat_evaluation,代码行数:24,代码来源:bwe_utils_unittest.py

示例5: test_loss_ratio_single_packet

# 需要导入模块: from packet import Packet [as 别名]
# 或者: from packet.Packet import arrival_time_ms [as 别名]
 def test_loss_ratio_single_packet(self):
     # Only id and arrival time matter here
     packet = Packet(1, None, None)
     packet.arrival_time_ms = 10.0
     self.assertEqual(loss_ratio([packet], 0.0), 0.0)
     self.assertEqual(loss_ratio([packet], 50.0), 0.0)
开发者ID:cesar-ilharco,项目名称:rmcat_evaluation,代码行数:8,代码来源:bwe_utils_unittest.py


注:本文中的packet.Packet.arrival_time_ms方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。