An object that monitors and reports back packet flows observed during a simulation. More...
#include <flow-monitor.h>
Classes | |
struct | FlowStats |
Structure that represents the measured metrics of an individual packet flow. More... | |
struct | TrackedPacket |
Public Member Functions | |
void | AddProbe (Ptr< FlowProbe > probe) |
void | CheckForLostPackets () |
Check right now for packets that appear to be lost. | |
void | CheckForLostPackets (Time maxDelay) |
std::vector< Ptr< FlowProbe > > | GetAllProbes () const |
Get a list of all FlowProbe's associated with this FlowMonitor. | |
std::map< FlowId, FlowStats > | GetFlowStats () const |
TypeId | GetInstanceTypeId () const |
void | ReportDrop (Ptr< FlowProbe > probe, FlowId flowId, FlowPacketId packetId, uint32_t packetSize, uint32_t reasonCode) |
void | ReportFirstTx (Ptr< FlowProbe > probe, FlowId flowId, FlowPacketId packetId, uint32_t packetSize) |
void | ReportForwarding (Ptr< FlowProbe > probe, FlowId flowId, FlowPacketId packetId, uint32_t packetSize) |
void | ReportLastRx (Ptr< FlowProbe > probe, FlowId flowId, FlowPacketId packetId, uint32_t packetSize) |
void | SerializeToXmlFile (std::string fileName, bool enableHistograms, bool enableProbes) |
void | SerializeToXmlStream (std::ostream &os, int indent, bool enableHistograms, bool enableProbes) |
std::string | SerializeToXmlString (int indent, bool enableHistograms, bool enableProbes) |
void | SetFlowClassifier (Ptr< FlowClassifier > classifier) |
Set the FlowClassifier to be used by the flow monitor. | |
void | Start (const Time &time) |
Set the time, counting from the current time, from which to start monitoring flows. | |
void | StartRightNow () |
Begin monitoring flows right now | |
void | Stop (const Time &time) |
Set the time, counting from the current time, from which to stop monitoring flows. | |
void | StopRightNow () |
End monitoring flows right now | |
Public Member Functions inherited from ns3::Object | |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
AggregateIterator | GetAggregateIterator (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Initialize (void) |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount (const SimpleRefCount &o) | |
uint32_t | GetReferenceCount (void) const |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
void | Ref (void) const |
void | Unref (void) const |
Public Member Functions inherited from ns3::ObjectBase | |
void | GetAttribute (std::string name, AttributeValue &value) const |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
static void | Cleanup (void) |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Protected Member Functions | |
virtual void | DoDispose (void) |
virtual void | NotifyConstructionCompleted () |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
virtual void | DoInitialize (void) |
virtual void | NotifyNewAggregate (void) |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Private Types | |
typedef std::map< std::pair < FlowId, FlowPacketId > , TrackedPacket > | TrackedPacketMap |
Private Member Functions | |
FlowStats & | GetStatsForFlow (FlowId flowId) |
void | PeriodicCheckForLostPackets () |
Private Attributes | |
Ptr< FlowClassifier > | m_classifier |
double | m_delayBinWidth |
bool | m_enabled |
double | m_flowInterruptionsBinWidth |
Time | m_flowInterruptionsMinTime |
std::vector< Ptr< FlowProbe > > | m_flowProbes |
std::map< FlowId, FlowStats > | m_flowStats |
double | m_jitterBinWidth |
Time | m_maxPerHopDelay |
double | m_packetSizeBinWidth |
EventId | m_startEvent |
EventId | m_stopEvent |
TrackedPacketMap | m_trackedPackets |
An object that monitors and reports back packet flows observed during a simulation.
The FlowMonitor class is responsible forcoordinating efforts regarding probes, and collects end-to-end flowstatistics.
Doxygen introspection did not find any typical Config paths.
No TraceSources are defined for this type.
Definition at line 41 of file flow-monitor.h.
Register a new FlowProbe that will begin monitoring and report events to this monitor. This method is normally only used by FlowProbe implementations.
Definition at line 334 of file flow-monitor.cc.
void ns3::FlowMonitor::CheckForLostPackets | ( | Time | maxDelay | ) |
Check right now for packets that appear to be lost, considering packets as lost if not seen in the network for a time larger than maxDelay
Definition at line 288 of file flow-monitor.cc.
References ns3::Simulator::Now(), and NS_ASSERT.
|
protectedvirtual |
This method is called by Object::Dispose or by the object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.
It is safe to call GetObject from within this method.
Reimplemented from ns3::Object.
Definition at line 91 of file flow-monitor.cc.
References ns3::Object::DoDispose().
std::map< FlowId, FlowMonitor::FlowStats > ns3::FlowMonitor::GetFlowStats | ( | ) | const |
Retrieve all collected the flow statistics. Note, if the FlowMonitor has not stopped monitoring yet, you should call CheckForLostPackets() to make sure all possibly lost packets are accounted for.
Definition at line 281 of file flow-monitor.cc.
|
virtual |
This method is typically implemented by ns3::Object::GetInstanceTypeId but some classes which derive from ns3::ObjectBase directly have to implement it themselves.
Reimplemented from ns3::Object.
Definition at line 79 of file flow-monitor.cc.
|
protectedvirtual |
This method is invoked once all member attributes have been initialized. Subclasses can override this method to be notified of this event but if they do this, they must chain up to their parent's NotifyConstructionCompleted method.
Reimplemented from ns3::ObjectBase.
Definition at line 327 of file flow-monitor.cc.
References ns3::ObjectBase::NotifyConstructionCompleted(), and ns3::Simulator::Schedule().
void ns3::FlowMonitor::ReportDrop | ( | Ptr< FlowProbe > | probe, |
FlowId | flowId, | ||
FlowPacketId | packetId, | ||
uint32_t | packetSize, | ||
uint32_t | reasonCode | ||
) |
FlowProbe implementations are supposed to call this method to report that a known packet is being dropped due to some reason.
Definition at line 248 of file flow-monitor.cc.
References ns3::FlowMonitor::FlowStats::bytesDropped, ns3::FlowMonitor::FlowStats::lostPackets, NS_LOG_DEBUG, and ns3::FlowMonitor::FlowStats::packetsDropped.
void ns3::FlowMonitor::ReportFirstTx | ( | Ptr< FlowProbe > | probe, |
FlowId | flowId, | ||
FlowPacketId | packetId, | ||
uint32_t | packetSize | ||
) |
FlowProbe implementations are supposed to call this method to report that a new packet was transmitted (but keep in mind the distinction between a new packet entering the system and a packet that is already known and is only being forwarded).
Definition at line 133 of file flow-monitor.cc.
References ns3::Simulator::Now(), NS_LOG_DEBUG, ns3::Seconds(), ns3::FlowMonitor::FlowStats::timeFirstTxPacket, ns3::FlowMonitor::FlowStats::timeLastTxPacket, ns3::FlowMonitor::FlowStats::txBytes, and ns3::FlowMonitor::FlowStats::txPackets.
void ns3::FlowMonitor::ReportForwarding | ( | Ptr< FlowProbe > | probe, |
FlowId | flowId, | ||
FlowPacketId | packetId, | ||
uint32_t | packetSize | ||
) |
FlowProbe implementations are supposed to call this method to report that a known packet is being forwarded.
Definition at line 161 of file flow-monitor.cc.
References ns3::Simulator::Now(), and NS_LOG_WARN.
void ns3::FlowMonitor::ReportLastRx | ( | Ptr< FlowProbe > | probe, |
FlowId | flowId, | ||
FlowPacketId | packetId, | ||
uint32_t | packetSize | ||
) |
FlowProbe implementations are supposed to call this method to report that a known packet is being received.
Definition at line 185 of file flow-monitor.cc.
References ns3::FlowMonitor::FlowStats::delayHistogram, ns3::FlowMonitor::FlowStats::delaySum, ns3::Time::GetSeconds(), ns3::FlowMonitor::FlowStats::jitterHistogram, ns3::FlowMonitor::FlowStats::jitterSum, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_WARN, ns3::FlowMonitor::FlowStats::packetSizeHistogram, ns3::FlowMonitor::FlowStats::rxBytes, ns3::FlowMonitor::FlowStats::rxPackets, ns3::Seconds(), ns3::FlowMonitor::FlowStats::timeFirstRxPacket, ns3::FlowMonitor::FlowStats::timeLastRxPacket, and ns3::FlowMonitor::FlowStats::timesForwarded.
void ns3::FlowMonitor::SerializeToXmlFile | ( | std::string | fileName, |
bool | enableHistograms, | ||
bool | enableProbes | ||
) |
Same as SerializeToXmlStream, but writes to a file instead
fileName | name or path of the output file that will be created |
enableHistograms | if true, include also the histograms in the output |
enableProbes | if true, include also the per-probe/flow pair statistics in the output |
Definition at line 488 of file flow-monitor.cc.
References SerializeToXmlStream().
void ns3::FlowMonitor::SerializeToXmlStream | ( | std::ostream & | os, |
int | indent, | ||
bool | enableHistograms, | ||
bool | enableProbes | ||
) |
Serializes the results to an std::ostream in XML format
os | the output stream |
indent | number of spaces to use as base indentation level |
enableHistograms | if true, include also the histograms in the output |
enableProbes | if true, include also the per-probe/flow pair statistics in the output |
Definition at line 398 of file flow-monitor.cc.
References CheckForLostPackets().
Referenced by SerializeToXmlFile(), and SerializeToXmlString().
std::string ns3::FlowMonitor::SerializeToXmlString | ( | int | indent, |
bool | enableHistograms, | ||
bool | enableProbes | ||
) |
Same as SerializeToXmlStream, but returns the output as a std::string
indent | number of spaces to use as base indentation level |
enableHistograms | if true, include also the histograms in the output |
enableProbes | if true, include also the per-probe/flow pair statistics in the output |
Definition at line 479 of file flow-monitor.cc.
References SerializeToXmlStream().