【问题标题】:UDP Throughput Calculation in NS3NS3 中的 UDP 吞吐量计算
【发布时间】:2020-07-19 10:29:18
【问题描述】:

我在 NS3 中有一个客户端/服务器拓扑,我想计算服务器上 UDP 流量的吞吐量。 这行代码sink = StaticCast<PacketSink> (tcpServerApp.Get (0));不起作用,因为它只能用于计算TCP数据包的吞吐量。如何计算服务器上接收到的 UDP 流量的吞吐量?

谢谢

【问题讨论】:

    标签: udp throughput ns-3


    【解决方案1】:

    您可以使用以下代码计算 UDP 数据包的吞吐量。你应该在Simulation::Run();之后使用这个代码

          uint64_t rxBytes = 0;
    
          rxBytes = payloadSize * DynamicCast<UdpServer> (serverApp.Get (0))->GetReceived ();
          double throughput = (rxBytes * 8) / (simulationTime * 1000000.0); //Mbit/s
          std::cout << "throughput = " << throughput << " Mbit/s" << std::endl;
    

    【讨论】:

    • 我实现了这段代码,但我得到了 SIGSEGV 错误。可能是什么问题?
    • 首先,这段代码应该可以工作。您需要相应地更改变量。如果没有看到您的完整错误消息,我无能为力。
    • 感谢您的宝贵时间。这是我使用的代码: Simulator::Run (); uint64_t rxBytes = 0; rxBytes = 1400 * DynamicCast (ServerApp.Get (0))->GetReceived ();双倍吞吐量 = (rxBytes * 8) / (10 * 1000000.0); //Mbit/s std::cout --command-template="gdb --args %s ")。
    • 在 gdb 下运行它,您将探索有关错误的更多详细信息。
    【解决方案2】:

    感谢您的回答。 我实现了代码:

    uint64_t rxBytes = 0;
      rxBytes = 1400 * DynamicCast<UdpServer> (ServerApp.Get (0))->GetReceived ();
      double throughput = (rxBytes * 8) / (10 * 1000000.0); //Mbit/s
      std::cout << "throughput = " << throughput << " Mbit/s" << std::end
    

    但我收到了 SIGSEGV 错误。 可能是什么问题?

    谢谢

    【讨论】:

      猜你喜欢
      • 2018-01-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-25
      • 2012-11-22
      • 2016-10-25
      • 2019-06-03
      • 1970-01-01
      相关资源
      最近更新 更多