Commit 5b7da0be authored by Jonathon Duerig's avatar Jonathon Duerig

LeastSquaresThroughput now stores the last reported measurement to the...

LeastSquaresThroughput now stores the last reported measurement to the monitor. It will send an authoritative report if the slope indicates saturation and the new measurement is different from the old. And it will send a tentative report of the slope indicates no saturation and the new measurement is greater than the old. Moderately tested(only in replay).
parent cde74d7a
......@@ -16,6 +16,7 @@ LeastSquaresThroughput::LeastSquaresThroughput(
, delay(newDelay)
, oldest(0)
, totalSamples(0)
, lastReport(0)
{
}
......@@ -81,17 +82,29 @@ void LeastSquaresThroughput::localAck(PacketInfo * packet)
// being filled up, which means that the link was saturated
// over the last SAMPLE_COUNT samples. So use the average to
// yield a result.
ostringstream buffer;
buffer << static_cast<int>(throughputAverage);
global::output->genericMessage(AUTHORITATIVE_BANDWIDTH, buffer.str(),
packet->elab);
ackValid = true;
if (static_cast<int>(throughputAverage) != lastReport)
{
lastReport = static_cast<int>(throughputAverage);
ostringstream buffer;
buffer << static_cast<int>(throughputAverage);
global::output->genericMessage(AUTHORITATIVE_BANDWIDTH, buffer.str(),
packet->elab);
}
}
else
{
ackValid = false;
// The buffers are not being filled up. So we just have a
// tentative throughput measurement.
if (static_cast<int>(throughputAverage) > lastReport)
{
lastReport = static_cast<int>(throughputAverage);
ostringstream buffer;
buffer << static_cast<int>(throughputAverage);
global::output->genericMessage(TENTATIVE_THROUGHPUT, buffer.str(),
packet->elab);
}
}
ackValid = true;
}
else
{
......
......@@ -33,6 +33,11 @@ private:
int oldest;
// The total number of samples ever encountered.
int totalSamples;
// The last number reported to the monitor in kbps.
// Only send bandwidth if it is different than this number.
// Only send throughput if it is > this number.
int lastReport;
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment