A Discrete-Event Network Simulator
API
flow-monitor.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 //
3 // Copyright (c) 2009 INESC Porto
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License version 2 as
7 // published by the Free Software Foundation;
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 //
18 // Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
19 //
20 
21 #include "flow-monitor.h"
22 #include "ns3/simulator.h"
23 #include "ns3/log.h"
24 #include "ns3/double.h"
25 #include <fstream>
26 #include <sstream>
27 
28 #define PERIODIC_CHECK_INTERVAL (Seconds (1))
29 
30 namespace ns3 {
31 
32 NS_LOG_COMPONENT_DEFINE ("FlowMonitor");
33 
34 NS_OBJECT_ENSURE_REGISTERED (FlowMonitor);
35 
36 TypeId
38 {
39  static TypeId tid = TypeId ("ns3::FlowMonitor")
40  .SetParent<Object> ()
41  .SetGroupName ("FlowMonitor")
42  .AddConstructor<FlowMonitor> ()
43  .AddAttribute ("MaxPerHopDelay", ("The maximum per-hop delay that should be considered. "
44  "Packets still not received after this delay are to be considered lost."),
45  TimeValue (Seconds (10.0)),
47  MakeTimeChecker ())
48  .AddAttribute ("StartTime", ("The time when the monitoring starts."),
49  TimeValue (Seconds (0.0)),
51  MakeTimeChecker ())
52  .AddAttribute ("DelayBinWidth", ("The width used in the delay histogram."),
53  DoubleValue (0.001),
55  MakeDoubleChecker <double> ())
56  .AddAttribute ("JitterBinWidth", ("The width used in the jitter histogram."),
57  DoubleValue (0.001),
59  MakeDoubleChecker <double> ())
60  .AddAttribute ("PacketSizeBinWidth", ("The width used in the packetSize histogram."),
61  DoubleValue (20),
63  MakeDoubleChecker <double> ())
64  .AddAttribute ("FlowInterruptionsBinWidth", ("The width used in the flowInterruptions histogram."),
65  DoubleValue (0.250),
67  MakeDoubleChecker <double> ())
68  .AddAttribute ("FlowInterruptionsMinTime", ("The minimum inter-arrival time that is considered a flow interruption."),
69  TimeValue (Seconds (0.5)),
71  MakeTimeChecker ())
72  ;
73  return tid;
74 }
75 
76 TypeId
78 {
79  return GetTypeId ();
80 }
81 
83  : m_enabled (false)
84 {
85  // m_histogramBinWidth=DEFAULT_BIN_WIDTH;
86 }
87 
88 void
90 {
91  for (std::list<Ptr<FlowClassifier> >::iterator iter = m_classifiers.begin ();
92  iter != m_classifiers.end ();
93  iter ++)
94  {
95  *iter = 0;
96  }
97  for (uint32_t i = 0; i < m_flowProbes.size (); i++)
98  {
99  m_flowProbes[i]->Dispose ();
100  m_flowProbes[i] = 0;
101  }
103 }
104 
107 {
108  FlowStatsContainerI iter;
109  iter = m_flowStats.find (flowId);
110  if (iter == m_flowStats.end ())
111  {
112  FlowMonitor::FlowStats &ref = m_flowStats[flowId];
113  ref.delaySum = Seconds (0);
114  ref.jitterSum = Seconds (0);
115  ref.lastDelay = Seconds (0);
116  ref.txBytes = 0;
117  ref.rxBytes = 0;
118  ref.txPackets = 0;
119  ref.rxPackets = 0;
120  ref.lostPackets = 0;
121  ref.timesForwarded = 0;
126  return ref;
127  }
128  else
129  {
130  return iter->second;
131  }
132 }
133 
134 
135 void
136 FlowMonitor::ReportFirstTx (Ptr<FlowProbe> probe, uint32_t flowId, uint32_t packetId, uint32_t packetSize)
137 {
138  if (!m_enabled)
139  {
140  return;
141  }
142  Time now = Simulator::Now ();
143  TrackedPacket &tracked = m_trackedPackets[std::make_pair (flowId, packetId)];
144  tracked.firstSeenTime = now;
145  tracked.lastSeenTime = tracked.firstSeenTime;
146  tracked.timesForwarded = 0;
147  NS_LOG_DEBUG ("ReportFirstTx: adding tracked packet (flowId=" << flowId << ", packetId=" << packetId
148  << ").");
149 
150  probe->AddPacketStats (flowId, packetSize, Seconds (0));
151 
152  FlowStats &stats = GetStatsForFlow (flowId);
153  stats.txBytes += packetSize;
154  stats.txPackets++;
155  if (stats.txPackets == 1)
156  {
157  stats.timeFirstTxPacket = now;
158  }
159  stats.timeLastTxPacket = now;
160 }
161 
162 
163 void
164 FlowMonitor::ReportForwarding (Ptr<FlowProbe> probe, uint32_t flowId, uint32_t packetId, uint32_t packetSize)
165 {
166  if (!m_enabled)
167  {
168  return;
169  }
170  std::pair<FlowId, FlowPacketId> key (flowId, packetId);
171  TrackedPacketMap::iterator tracked = m_trackedPackets.find (key);
172  if (tracked == m_trackedPackets.end ())
173  {
174  NS_LOG_WARN ("Received packet forward report (flowId=" << flowId << ", packetId=" << packetId
175  << ") but not known to be transmitted.");
176  return;
177  }
178 
179  tracked->second.timesForwarded++;
180  tracked->second.lastSeenTime = Simulator::Now ();
181 
182  Time delay = (Simulator::Now () - tracked->second.firstSeenTime);
183  probe->AddPacketStats (flowId, packetSize, delay);
184 }
185 
186 
187 void
188 FlowMonitor::ReportLastRx (Ptr<FlowProbe> probe, uint32_t flowId, uint32_t packetId, uint32_t packetSize)
189 {
190  if (!m_enabled)
191  {
192  return;
193  }
194  TrackedPacketMap::iterator tracked = m_trackedPackets.find (std::make_pair (flowId, packetId));
195  if (tracked == m_trackedPackets.end ())
196  {
197  NS_LOG_WARN ("Received packet last-tx report (flowId=" << flowId << ", packetId=" << packetId
198  << ") but not known to be transmitted.");
199  return;
200  }
201 
202  Time now = Simulator::Now ();
203  Time delay = (now - tracked->second.firstSeenTime);
204  probe->AddPacketStats (flowId, packetSize, delay);
205 
206  FlowStats &stats = GetStatsForFlow (flowId);
207  stats.delaySum += delay;
208  stats.delayHistogram.AddValue (delay.GetSeconds ());
209  if (stats.rxPackets > 0 )
210  {
211  Time jitter = stats.lastDelay - delay;
212  if (jitter > Seconds (0))
213  {
214  stats.jitterSum += jitter;
215  stats.jitterHistogram.AddValue (jitter.GetSeconds ());
216  }
217  else
218  {
219  stats.jitterSum -= jitter;
220  stats.jitterHistogram.AddValue (-jitter.GetSeconds ());
221  }
222  }
223  stats.lastDelay = delay;
224 
225  stats.rxBytes += packetSize;
226  stats.packetSizeHistogram.AddValue ((double) packetSize);
227  stats.rxPackets++;
228  if (stats.rxPackets == 1)
229  {
230  stats.timeFirstRxPacket = now;
231  }
232  else
233  {
234  // measure possible flow interruptions
235  Time interArrivalTime = now - stats.timeLastRxPacket;
236  if (interArrivalTime > m_flowInterruptionsMinTime)
237  {
238  stats.flowInterruptionsHistogram.AddValue (interArrivalTime.GetSeconds ());
239  }
240  }
241  stats.timeLastRxPacket = now;
242  stats.timesForwarded += tracked->second.timesForwarded;
243 
244  NS_LOG_DEBUG ("ReportLastTx: removing tracked packet (flowId="
245  << flowId << ", packetId=" << packetId << ").");
246 
247  m_trackedPackets.erase (tracked); // we don't need to track this packet anymore
248 }
249 
250 void
251 FlowMonitor::ReportDrop (Ptr<FlowProbe> probe, uint32_t flowId, uint32_t packetId, uint32_t packetSize,
252  uint32_t reasonCode)
253 {
254  if (!m_enabled)
255  {
256  return;
257  }
258 
259  probe->AddPacketDropStats (flowId, packetSize, reasonCode);
260 
261  FlowStats &stats = GetStatsForFlow (flowId);
262  stats.lostPackets++;
263  if (stats.packetsDropped.size () < reasonCode + 1)
264  {
265  stats.packetsDropped.resize (reasonCode + 1, 0);
266  stats.bytesDropped.resize (reasonCode + 1, 0);
267  }
268  ++stats.packetsDropped[reasonCode];
269  stats.bytesDropped[reasonCode] += packetSize;
270  NS_LOG_DEBUG ("++stats.packetsDropped[" << reasonCode<< "]; // becomes: " << stats.packetsDropped[reasonCode]);
271 
272  TrackedPacketMap::iterator tracked = m_trackedPackets.find (std::make_pair (flowId, packetId));
273  if (tracked != m_trackedPackets.end ())
274  {
275  // we don't need to track this packet anymore
276  // FIXME: this will not necessarily be true with broadcast/multicast
277  NS_LOG_DEBUG ("ReportDrop: removing tracked packet (flowId="
278  << flowId << ", packetId=" << packetId << ").");
279  m_trackedPackets.erase (tracked);
280  }
281 }
282 
285 {
286  return m_flowStats;
287 }
288 
289 
290 void
292 {
293  Time now = Simulator::Now ();
294 
295  for (TrackedPacketMap::iterator iter = m_trackedPackets.begin ();
296  iter != m_trackedPackets.end (); )
297  {
298  if (now - iter->second.lastSeenTime >= maxDelay)
299  {
300  // packet is considered lost, add it to the loss statistics
301  FlowStatsContainerI flow = m_flowStats.find (iter->first.first);
302  NS_ASSERT (flow != m_flowStats.end ());
303  flow->second.lostPackets++;
304 
305  // we won't track it anymore
306  m_trackedPackets.erase (iter++);
307  }
308  else
309  {
310  iter++;
311  }
312  }
313 }
314 
315 void
317 {
319 }
320 
321 void
323 {
326 }
327 
328 void
330 {
333 }
334 
335 void
337 {
338  m_flowProbes.push_back (probe);
339 }
340 
341 
344 {
345  return m_flowProbes;
346 }
347 
348 
349 void
351 {
352  if (m_enabled)
353  {
354  return;
355  }
358 }
359 
360 void
361 FlowMonitor::Stop (const Time &time)
362 {
363  if (!m_enabled)
364  {
365  return;
366  }
369 }
370 
371 
372 void
374 {
375  if (m_enabled)
376  {
377  return;
378  }
379  m_enabled = true;
380 }
381 
382 
383 void
385 {
386  if (!m_enabled)
387  {
388  return;
389  }
390  m_enabled = false;
392 }
393 
394 void
396 {
397  m_classifiers.push_back (classifier);
398 }
399 
400 void
401 FlowMonitor::SerializeToXmlStream (std::ostream &os, uint16_t indent, bool enableHistograms, bool enableProbes)
402 {
404 
405  os << std::string ( indent, ' ' ) << "<FlowMonitor>\n";
406  indent += 2;
407  os << std::string ( indent, ' ' ) << "<FlowStats>\n";
408  indent += 2;
409  for (FlowStatsContainerCI flowI = m_flowStats.begin ();
410  flowI != m_flowStats.end (); flowI++)
411  {
412  os << std::string ( indent, ' ' );
413 #define ATTRIB(name) << " " # name "=\"" << flowI->second.name << "\""
414  os << "<Flow flowId=\"" << flowI->first << "\""
415  ATTRIB (timeFirstTxPacket)
416  ATTRIB (timeFirstRxPacket)
417  ATTRIB (timeLastTxPacket)
418  ATTRIB (timeLastRxPacket)
419  ATTRIB (delaySum)
420  ATTRIB (jitterSum)
421  ATTRIB (lastDelay)
422  ATTRIB (txBytes)
423  ATTRIB (rxBytes)
424  ATTRIB (txPackets)
425  ATTRIB (rxPackets)
426  ATTRIB (lostPackets)
427  ATTRIB (timesForwarded)
428  << ">\n";
429 #undef ATTRIB
430 
431  indent += 2;
432  for (uint32_t reasonCode = 0; reasonCode < flowI->second.packetsDropped.size (); reasonCode++)
433  {
434  os << std::string ( indent, ' ' );
435  os << "<packetsDropped reasonCode=\"" << reasonCode << "\""
436  << " number=\"" << flowI->second.packetsDropped[reasonCode]
437  << "\" />\n";
438  }
439  for (uint32_t reasonCode = 0; reasonCode < flowI->second.bytesDropped.size (); reasonCode++)
440  {
441  os << std::string ( indent, ' ' );
442  os << "<bytesDropped reasonCode=\"" << reasonCode << "\""
443  << " bytes=\"" << flowI->second.bytesDropped[reasonCode]
444  << "\" />\n";
445  }
446  if (enableHistograms)
447  {
448  flowI->second.delayHistogram.SerializeToXmlStream (os, indent, "delayHistogram");
449  flowI->second.jitterHistogram.SerializeToXmlStream (os, indent, "jitterHistogram");
450  flowI->second.packetSizeHistogram.SerializeToXmlStream (os, indent, "packetSizeHistogram");
451  flowI->second.flowInterruptionsHistogram.SerializeToXmlStream (os, indent, "flowInterruptionsHistogram");
452  }
453  indent -= 2;
454 
455  os << std::string ( indent, ' ' ) << "</Flow>\n";
456  }
457  indent -= 2;
458  os << std::string ( indent, ' ' ) << "</FlowStats>\n";
459 
460  for (std::list<Ptr<FlowClassifier> >::iterator iter = m_classifiers.begin ();
461  iter != m_classifiers.end ();
462  iter ++)
463  {
464  (*iter)->SerializeToXmlStream (os, indent);
465  }
466 
467  if (enableProbes)
468  {
469  os << std::string ( indent, ' ' ) << "<FlowProbes>\n";
470  indent += 2;
471  for (uint32_t i = 0; i < m_flowProbes.size (); i++)
472  {
473  m_flowProbes[i]->SerializeToXmlStream (os, indent, i);
474  }
475  indent -= 2;
476  os << std::string ( indent, ' ' ) << "</FlowProbes>\n";
477  }
478 
479  indent -= 2;
480  os << std::string ( indent, ' ' ) << "</FlowMonitor>\n";
481 }
482 
483 
484 std::string
485 FlowMonitor::SerializeToXmlString (uint16_t indent, bool enableHistograms, bool enableProbes)
486 {
487  std::ostringstream os;
488  SerializeToXmlStream (os, indent, enableHistograms, enableProbes);
489  return os.str ();
490 }
491 
492 
493 void
494 FlowMonitor::SerializeToXmlFile (std::string fileName, bool enableHistograms, bool enableProbes)
495 {
496  std::ofstream os (fileName.c_str (), std::ios::out|std::ios::binary);
497  os << "<?xml version=\"1.0\" ?>\n";
498  SerializeToXmlStream (os, 0, enableHistograms, enableProbes);
499  os.close ();
500 }
501 
502 
503 } // namespace ns3
504 
#define PERIODIC_CHECK_INTERVAL
Definition: flow-monitor.cc:28
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
const FlowStatsContainer & GetFlowStats() const
Retrieve all collected the flow statistics.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
void CheckForLostPackets()
Check right now for packets that appear to be lost.
void StartRightNow()
Begin monitoring flows right now
uint32_t lostPackets
Total number of packets that are assumed to be lost, i.e.
Definition: flow-monitor.h:107
uint32_t rxPackets
Total number of received packets for the flow.
Definition: flow-monitor.h:100
uint32_t txPackets
Total number of transmitted packets for the flow.
Definition: flow-monitor.h:98
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
Time m_maxPerHopDelay
Minimum per-hop delay.
Definition: flow-monitor.h:281
static TypeId GetTypeId()
Get the type ID.
Definition: flow-monitor.cc:37
void 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 dro...
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
Definition: simulator.cc:346
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:346
Time delaySum
Contains the sum of all end-to-end delays for all received packets of the flow.
Definition: flow-monitor.h:78
std::vector< uint64_t > bytesDropped
This attribute also tracks the number of lost bytes.
Definition: flow-monitor.h:136
void AddPacketStats(FlowId flowId, uint32_t packetSize, Time delayFromFirstProbe)
Add a packet data to the flow stats.
Definition: flow-probe.cc:57
std::string SerializeToXmlString(uint16_t indent, bool enableHistograms, bool enableProbes)
Same as SerializeToXmlStream, but returns the output as a std::string.
Time m_flowInterruptionsMinTime
Flow interruptions minimum time.
Definition: flow-monitor.h:294
void 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 transmitte...
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:446
TrackedPacketMap m_trackedPackets
Tracked packets.
Definition: flow-monitor.h:280
FlowStatsContainer m_flowStats
FlowId –> FlowStats.
Definition: flow-monitor.h:276
Time lastDelay
Contains the last measured delay of a packet It is stored to measure the packet's Jitter...
Definition: flow-monitor.h:91
def indent(source, debug, level)
Definition: check-style.py:424
std::map< FlowId, FlowStats > FlowStatsContainer
Container: FlowId, FlowStats.
Definition: flow-monitor.h:216
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:341
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Definition: simulator.h:1375
Time firstSeenTime
absolute time when the packet was first seen by a probe
Definition: flow-monitor.h:270
AttributeValue implementation for Time.
Definition: nstime.h:1055
std::list< Ptr< FlowClassifier > > m_classifiers
the FlowClassifiers
Definition: flow-monitor.h:285
Time jitterSum
Contains the sum of all end-to-end delay jitter (delay variation) values for all received packets of ...
Definition: flow-monitor.h:87
bool m_enabled
FlowMon is enabled.
Definition: flow-monitor.h:289
virtual void NotifyConstructionCompleted(void)
Notifier called once the ObjectBase is fully constructed.
Definition: object-base.cc:74
void SetDefaultBinWidth(double binWidth)
Set the bin width.
Definition: histogram.cc:66
Time timeFirstTxPacket
Contains the absolute time when the first packet in the flow was transmitted, i.e.
Definition: flow-monitor.h:60
double m_packetSizeBinWidth
packet size bin width (for histograms)
Definition: flow-monitor.h:292
FlowStats & GetStatsForFlow(FlowId flowId)
Get the stats for a given flow.
double m_jitterBinWidth
Jitter bin width (for histograms)
Definition: flow-monitor.h:291
EventId m_stopEvent
Stop event.
Definition: flow-monitor.h:288
#define list
std::map< FlowId, FlowStats >::const_iterator FlowStatsContainerCI
Container Const Iterator: FlowId, FlowStats.
Definition: flow-monitor.h:220
Time lastSeenTime
absolute time when the packet was last seen by a probe
Definition: flow-monitor.h:271
double m_delayBinWidth
Delay bin width (for histograms)
Definition: flow-monitor.h:290
Every class exported by the ns3 library is enclosed in the ns3 namespace.
const FlowProbeContainer & GetAllProbes() const
Get a list of all FlowProbe's associated with this FlowMonitor.
virtual void NotifyConstructionCompleted()
Notifier called once the ObjectBase is fully constructed.
#define ATTRIB(name)
void Stop(const Time &time)
Set the time, counting from the current time, from which to stop monitoring flows.
void AddPacketDropStats(FlowId flowId, uint32_t packetSize, uint32_t reasonCode)
Add a packet drop data to the flow stats.
Definition: flow-probe.cc:66
Time timeFirstRxPacket
Contains the absolute time when the first packet in the flow was received by an end node...
Definition: flow-monitor.h:65
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: nstime.h:1056
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:249
uint32_t timesForwarded
Contains the number of times a packet has been reportedly forwarded, summed for all received packets ...
Definition: flow-monitor.h:111
std::map< FlowId, FlowStats >::iterator FlowStatsContainerI
Container Iterator: FlowId, FlowStats.
Definition: flow-monitor.h:218
Time timeLastRxPacket
Contains the absolute time when the last packet in the flow was received, i.e.
Definition: flow-monitor.h:74
void AddFlowClassifier(Ptr< FlowClassifier > classifier)
Add a FlowClassifier to be used by the flow monitor.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: double.h:42
void StopRightNow()
End monitoring flows right now
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:261
Histogram delayHistogram
Histogram of the packet delays.
Definition: flow-monitor.h:114
void SerializeToXmlFile(std::string fileName, bool enableHistograms, bool enableProbes)
Same as SerializeToXmlStream, but writes to a file instead.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:269
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:993
virtual void DoDispose(void)
Destructor implementation.
Definition: flow-monitor.cc:89
Histogram flowInterruptionsHistogram
histogram of durations of flow interruptions
Definition: flow-monitor.h:137
uint64_t txBytes
Total number of transmitted bytes for the flow.
Definition: flow-monitor.h:94
Structure that represents the measured metrics of an individual packet flow.
Definition: flow-monitor.h:55
double m_flowInterruptionsBinWidth
Flow interruptions bin width (for histograms)
Definition: flow-monitor.h:293
Structure to represent a single tracked packet data.
Definition: flow-monitor.h:268
static const uint32_t packetSize
Histogram jitterHistogram
Histogram of the packet jitters.
Definition: flow-monitor.h:116
A base class which provides memory management and object aggregation.
Definition: object.h:87
EventId m_startEvent
Start event.
Definition: flow-monitor.h:287
void Start(const Time &time)
Set the time, counting from the current time, from which to start monitoring flows.
void 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 for...
uint64_t rxBytes
Total number of received bytes for the flow.
Definition: flow-monitor.h:96
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Definition: double.h:41
void AddValue(double value)
Add a value to the histogram.
Definition: histogram.cc:80
void PeriodicCheckForLostPackets()
Periodic function to check for lost packets and prune statistics.
uint32_t timesForwarded
number of times the packet was reportedly forwarded
Definition: flow-monitor.h:272
An object that monitors and reports back packet flows observed during a simulation.
Definition: flow-monitor.h:50
void AddProbe(Ptr< FlowProbe > probe)
Register a new FlowProbe that will begin monitoring and report events to this monitor.
a unique identifier for an interface.
Definition: type-id.h:58
std::vector< Ptr< FlowProbe > > FlowProbeContainer
Container: FlowProbe.
Definition: flow-monitor.h:222
Time timeLastTxPacket
Contains the absolute time when the last packet in the flow was transmitted, i.e. ...
Definition: flow-monitor.h:70
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:914
void 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 rec...
Histogram packetSizeHistogram
Histogram of the packet sizes.
Definition: flow-monitor.h:118
FlowProbeContainer m_flowProbes
all the FlowProbes
Definition: flow-monitor.h:282
virtual TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition: flow-monitor.cc:77
void SerializeToXmlStream(std::ostream &os, uint16_t indent, bool enableHistograms, bool enableProbes)
Serializes the results to an std::ostream in XML format.
uint32_t FlowId
Abstract identifier of a packet flow.
std::vector< uint32_t > packetsDropped
This attribute also tracks the number of lost packets and bytes, but discriminates the losses by a re...
Definition: flow-monitor.h:132