FlowMonitor: measure flow interruptions

This commit is contained in:
Gustavo J. A. M. Carneiro
2010-03-19 11:28:49 +00:00
parent 14e174bf7b
commit ca2220ad7b
4 changed files with 26 additions and 0 deletions

View File

@@ -290,6 +290,8 @@ def register_Ns3FlowMonitorFlowStats_methods(root_module, cls):
cls.add_instance_attribute('delayHistogram', 'ns3::Histogram', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::delaySum [variable]
cls.add_instance_attribute('delaySum', 'ns3::Time', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::flowInterruptionsHistogram [variable]
cls.add_instance_attribute('flowInterruptionsHistogram', 'ns3::Histogram', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::jitterHistogram [variable]
cls.add_instance_attribute('jitterHistogram', 'ns3::Histogram', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::jitterSum [variable]

View File

@@ -290,6 +290,8 @@ def register_Ns3FlowMonitorFlowStats_methods(root_module, cls):
cls.add_instance_attribute('delayHistogram', 'ns3::Histogram', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::delaySum [variable]
cls.add_instance_attribute('delaySum', 'ns3::Time', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::flowInterruptionsHistogram [variable]
cls.add_instance_attribute('flowInterruptionsHistogram', 'ns3::Histogram', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::jitterHistogram [variable]
cls.add_instance_attribute('jitterHistogram', 'ns3::Histogram', is_const=False)
## flow-monitor.h: ns3::FlowMonitor::FlowStats::jitterSum [variable]

View File

@@ -63,6 +63,14 @@ FlowMonitor::GetTypeId (void)
DoubleValue (20),
MakeDoubleAccessor (&FlowMonitor::m_packetSizeBinWidth),
MakeDoubleChecker <double> ())
.AddAttribute ("FlowInterruptionsBinWidth", ("The width used in the flowInterruptions histogram."),
DoubleValue (0.250),
MakeDoubleAccessor (&FlowMonitor::m_flowInterruptionsBinWidth),
MakeDoubleChecker <double> ())
.AddAttribute ("FlowInterruptionsMinTime", ("The minimum inter-arrival time that is considered a flow interruption."),
TimeValue (Seconds (0.5)),
MakeTimeAccessor (&FlowMonitor::m_flowInterruptionsMinTime),
MakeTimeChecker ())
;
return tid;
}
@@ -100,6 +108,7 @@ FlowMonitor::GetStatsForFlow (FlowId flowId)
ref.delayHistogram.SetDefaultBinWidth (m_delayBinWidth);
ref.jitterHistogram.SetDefaultBinWidth (m_jitterBinWidth);
ref.packetSizeHistogram.SetDefaultBinWidth (m_packetSizeBinWidth);
ref.flowInterruptionsHistogram.SetDefaultBinWidth (m_flowInterruptionsBinWidth);
return ref;
}
else
@@ -206,6 +215,15 @@ FlowMonitor::ReportLastRx (Ptr<FlowProbe> probe, uint32_t flowId, uint32_t packe
{
stats.timeFirstRxPacket = now;
}
else
{
// measure possible flow interruptions
Time interArrivalTime = now - stats.timeLastRxPacket;
if (interArrivalTime > m_flowInterruptionsMinTime)
{
stats.flowInterruptionsHistogram.AddValue (interArrivalTime.GetSeconds ());
}
}
stats.timeLastRxPacket = now;
stats.timesForwarded += tracked->second.timesForwarded;
@@ -418,6 +436,7 @@ FlowMonitor::SerializeToXmlStream (std::ostream &os, int indent, bool enableHist
flowI->second.delayHistogram.SerializeToXmlStream (os, indent, "delayHistogram");
flowI->second.jitterHistogram.SerializeToXmlStream (os, indent, "jitterHistogram");
flowI->second.packetSizeHistogram.SerializeToXmlStream (os, indent, "packetSizeHistogram");
flowI->second.flowInterruptionsHistogram.SerializeToXmlStream (os, indent, "flowInterruptionsHistogram");
}
indent -= 2;

View File

@@ -123,6 +123,7 @@ public:
/// This attribute also tracks the number of lost bytes. See also
/// comment in attribute packetsDropped.
std::vector<uint64_t> bytesDropped; // bytesDropped[reasonCode] => number of dropped bytes
Histogram flowInterruptionsHistogram; // histogram of durations of flow interruptions
};
// --- basic methods ---
@@ -232,6 +233,8 @@ private:
double m_delayBinWidth;
double m_jitterBinWidth;
double m_packetSizeBinWidth;
double m_flowInterruptionsBinWidth;
Time m_flowInterruptionsMinTime;
FlowStats& GetStatsForFlow (FlowId flowId);
void PeriodicCheckForLostPackets ();