hamidreza davirani hamidreza davirani - 3 months ago 36
C++ Question

calculation of throughput for udp connection in ns3

This is a network question not a programing one:

I have found a piece of code for throughput calculation of a UDP connection which is working fine, I wonder if someone can explain lines below.

What are the measuring units of variables and etc?

float totalPacketsThrough = DynamicCast<UdpServer> (serverJobs.Get (0))->GetReceived () ;
throughput = totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0);

Answer

A bit of guesswork, but looks pretty straightforward to me:

  • totalPacketsThrough == number of UDP packets received
  • payloadSize == size in bytes of payload portion of packets received
  • 8 == bits / byte
  • simulationTime == Time over which the test was run, in seconds.
  • 1000000.0 == bits-to-megabits scaling factor

Result is presumably megabits-per-second effective throughput