Bug 1675

Summary: throughput computation error
Product: ns-3 Reporter: Junling Bu <linlinjavaer>
Component: examplesAssignee: ns-bugs <ns-bugs>
Status: RESOLVED FIXED    
Severity: minor CC: tommaso.pecorella
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   
Attachments: patch for throughput computation error

Description Junling Bu 2013-05-06 10:10:18 UTC
1 in examples/wireless/wifi-hidden-terminal.cc line 161
std::cout << "  Throughput: " << i->second.rxBytes * 8.0 / 10.0 / 1024 / 1024  << " Mbps\n";
according to https://en.wikipedia.org/wiki/Megabit_per_second#Megabit_per_second
Mbps means 1,000,000 bits per second
so i->second.rxBytes * 8.0 / 10.0 / 1000 / 1000

2 in examples/wireless/multirate.cc line 173
"void
Experiment::CheckThroughput ()
{
  double mbs = ((bytesTotal * 8.0) /1000000);
  bytesTotal = 0;
  m_output.Add ((Simulator::Now ()).GetSeconds (), mbs);

  //check throughput every 1/10 of a second 
  Simulator::Schedule (Seconds (0.1), &Experiment::CheckThroughput, this);
}"
here throughput computation result is the bits sent in 0.1s.
changing to "double mbs = ((bytesTotal * 8.0) /1000000/0.1);"
seems be better.
Comment 1 Tommaso Pecorella 2013-05-06 10:31:43 UTC
You're right.

The first one is a mebibit per second (Mibit/s) technically.
On the other hand, the -bi notation is not used often in telecommunications, and for the throughput is almost never used. Hence...

About the second point, I'm ok with it as well. Even if there's no clear indication of the data unit, the expected one is Mb/s.
A better approach, tho, is to define the sampling period in one variable and using it both for the throughput normalization and for the event schedule.

Please provide a patch for this. It will be fixed *after* 3.17 release.
Comment 2 Junling Bu 2013-05-07 00:01:12 UTC
Created attachment 1594 [details]
patch for throughput computation error

This is the patch for bug 1675 according to Tommaso Pecorella's comment.
However, here I still have some confusions.
1 the way of throughput computation is normally to use packets received in one second. So the output is Mbps in 0s, 1s, 2s...
but I think whether time point here is 0.5s better than 1s, 
like Mbps in 0s, 0.5s, 1.5s...

2 according to https://en.wikipedia.org/wiki/Bit_rate, https://en.wikipedia.org/wiki/Throughput, https://en.wikipedia.org/wiki/Goodput
"Network throughput" is below the network layer and above the physical layer
"Goodput" is useful information that is delivered per second to the application layer protocol.
And many CheckThroughput functions in multiple examples are computed by measuring the packets received, which I think in fact are goodput functions.

I think the two confusions are really not issues,  just my personal thoughts:)
Comment 3 Tommaso Pecorella 2013-05-07 05:36:48 UTC
+1 for the patch.

About the Goodput, I agree with you that the most correct term should be this one when measuring the application-level data rate. On the other hand it's not very used, and people is still puzzled when they see it.
About the specific case, in the wifi-hidden-terminal.cc it IS throughput, as it's measured by flow monitor. In the multirate.cc it should be Goodput, as it's UDP-level. 

Still, I don't think it's a big issue. The users can easily figure our what it is. Well, they *should* be able to...
Comment 4 Tommaso Pecorella 2013-07-09 15:15:06 UTC
push in changeset: 9916:725d7c8811b8