From 0480c7596146646ebd8299adc7aff07d9c955dfa Mon Sep 17 00:00:00 2001 From: Aniket Singh Date: Tue, 28 May 2024 22:18:31 +0530 Subject: [PATCH] examples: Fix curTime format for TraceThroughput in tcp-bbr-example --- examples/tcp/tcp-bbr-example.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/tcp/tcp-bbr-example.cc b/examples/tcp/tcp-bbr-example.cc index 729c4b3fa..32c0f63ef 100644 --- a/examples/tcp/tcp-bbr-example.cc +++ b/examples/tcp/tcp-bbr-example.cc @@ -41,7 +41,7 @@ // * bbr-3-0.pcap for the first interface on R2 // * bbr-3-1.pcap for the second interface on R2 // (2) cwnd.dat file contains congestion window trace for the sender node -// (3) throughput.dat file contains sender side throughput trace +// (3) throughput.dat file contains sender side throughput trace (throughput is in Mbit/s) // (4) queueSize.dat file contains queue length trace from the bottleneck link // // BBR algorithm enters PROBE_RTT phase in every 10 seconds. The congestion @@ -81,9 +81,12 @@ TraceThroughput(Ptr monitor) { auto itr = stats.begin(); Time curTime = Now(); - throughput << curTime << " " + + // Convert (curTime - prevTime) to microseconds so that throughput is in bits per + // microsecond (which is equivalent to Mbps) + throughput << curTime.GetSeconds() << "s " << 8 * (itr->second.txBytes - prev) / ((curTime - prevTime).ToDouble(Time::US)) - << std::endl; + << " Mbps" << std::endl; prevTime = curTime; prev = itr->second.txBytes; }