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  NS_LOG_FUNCTION (this);
86 }
87 
88 void
90 {
91  NS_LOG_FUNCTION (this);
94  for (std::list<Ptr<FlowClassifier> >::iterator iter = m_classifiers.begin ();
95  iter != m_classifiers.end ();
96  iter ++)
97  {
98  *iter = 0;
99  }
100  for (uint32_t i = 0; i < m_flowProbes.size (); i++)
101  {
102  m_flowProbes[i]->Dispose ();
103  m_flowProbes[i] = 0;
104  }
106 }
107 
110 {
111  NS_LOG_FUNCTION (this);
112  FlowStatsContainerI iter;
113  iter = m_flowStats.find (flowId);
114  if (iter == m_flowStats.end ())
115  {
116  FlowMonitor::FlowStats &ref = m_flowStats[flowId];
117  ref.delaySum = Seconds (0);
118  ref.jitterSum = Seconds (0);
119  ref.lastDelay = Seconds (0);
120  ref.txBytes = 0;
121  ref.rxBytes = 0;
122  ref.txPackets = 0;
123  ref.rxPackets = 0;
124  ref.lostPackets = 0;
125  ref.timesForwarded = 0;
130  return ref;
131  }
132  else
133  {
134  return iter->second;
135  }
136 }
137 
138 
139 void
140 FlowMonitor::ReportFirstTx (Ptr<FlowProbe> probe, uint32_t flowId, uint32_t packetId, uint32_t packetSize)
141 {
142  NS_LOG_FUNCTION (this << probe << flowId << packetId << packetSize);
143  if (!m_enabled)
144  {
145  NS_LOG_DEBUG ("FlowMonitor not enabled; returning");
146  return;
147  }
148  Time now = Simulator::Now ();
149  TrackedPacket &tracked = m_trackedPackets[std::make_pair (flowId, packetId)];
150  tracked.firstSeenTime = now;
151  tracked.lastSeenTime = tracked.firstSeenTime;
152  tracked.timesForwarded = 0;
153  NS_LOG_DEBUG ("ReportFirstTx: adding tracked packet (flowId=" << flowId << ", packetId=" << packetId
154  << ").");
155 
156  probe->AddPacketStats (flowId, packetSize, Seconds (0));
157 
158  FlowStats &stats = GetStatsForFlow (flowId);
159  stats.txBytes += packetSize;
160  stats.txPackets++;
161  if (stats.txPackets == 1)
162  {
163  stats.timeFirstTxPacket = now;
164  }
165  stats.timeLastTxPacket = now;
166 }
167 
168 
169 void
170 FlowMonitor::ReportForwarding (Ptr<FlowProbe> probe, uint32_t flowId, uint32_t packetId, uint32_t packetSize)
171 {
172  NS_LOG_FUNCTION (this << probe << flowId << packetId << packetSize);
173  if (!m_enabled)
174  {
175  NS_LOG_DEBUG ("FlowMonitor not enabled; returning");
176  return;
177  }
178  std::pair<FlowId, FlowPacketId> key (flowId, packetId);
179  TrackedPacketMap::iterator tracked = m_trackedPackets.find (key);
180  if (tracked == m_trackedPackets.end ())
181  {
182  NS_LOG_WARN ("Received packet forward report (flowId=" << flowId << ", packetId=" << packetId
183  << ") but not known to be transmitted.");
184  return;
185  }
186 
187  tracked->second.timesForwarded++;
188  tracked->second.lastSeenTime = Simulator::Now ();
189 
190  Time delay = (Simulator::Now () - tracked->second.firstSeenTime);
191  probe->AddPacketStats (flowId, packetSize, delay);
192 }
193 
194 
195 void
196 FlowMonitor::ReportLastRx (Ptr<FlowProbe> probe, uint32_t flowId, uint32_t packetId, uint32_t packetSize)
197 {
198  NS_LOG_FUNCTION (this << probe << flowId << packetId << packetSize);
199  if (!m_enabled)
200  {
201  NS_LOG_DEBUG ("FlowMonitor not enabled; returning");
202  return;
203  }
204  TrackedPacketMap::iterator tracked = m_trackedPackets.find (std::make_pair (flowId, packetId));
205  if (tracked == m_trackedPackets.end ())
206  {
207  NS_LOG_WARN ("Received packet last-tx report (flowId=" << flowId << ", packetId=" << packetId
208  << ") but not known to be transmitted.");
209  return;
210  }
211 
212  Time now = Simulator::Now ();
213  Time delay = (now - tracked->second.firstSeenTime);
214  probe->AddPacketStats (flowId, packetSize, delay);
215 
216  FlowStats &stats = GetStatsForFlow (flowId);
217  stats.delaySum += delay;
218  stats.delayHistogram.AddValue (delay.GetSeconds ());
219  if (stats.rxPackets > 0 )
220  {
221  Time jitter = stats.lastDelay - delay;
222  if (jitter > Seconds (0))
223  {
224  stats.jitterSum += jitter;
225  stats.jitterHistogram.AddValue (jitter.GetSeconds ());
226  }
227  else
228  {
229  stats.jitterSum -= jitter;
230  stats.jitterHistogram.AddValue (-jitter.GetSeconds ());
231  }
232  }
233  stats.lastDelay = delay;
234 
235  stats.rxBytes += packetSize;
236  stats.packetSizeHistogram.AddValue ((double) packetSize);
237  stats.rxPackets++;
238  if (stats.rxPackets == 1)
239  {
240  stats.timeFirstRxPacket = now;
241  }
242  else
243  {
244  // measure possible flow interruptions
245  Time interArrivalTime = now - stats.timeLastRxPacket;
246  if (interArrivalTime > m_flowInterruptionsMinTime)
247  {
248  stats.flowInterruptionsHistogram.AddValue (interArrivalTime.GetSeconds ());
249  }
250  }
251  stats.timeLastRxPacket = now;
252  stats.timesForwarded += tracked->second.timesForwarded;
253 
254  NS_LOG_DEBUG ("ReportLastTx: removing tracked packet (flowId="
255  << flowId << ", packetId=" << packetId << ").");
256 
257  m_trackedPackets.erase (tracked); // we don't need to track this packet anymore
258 }
259 
260 void
261 FlowMonitor::ReportDrop (Ptr<FlowProbe> probe, uint32_t flowId, uint32_t packetId, uint32_t packetSize,
262  uint32_t reasonCode)
263 {
264  NS_LOG_FUNCTION (this << probe << flowId << packetId << packetSize << reasonCode);
265  if (!m_enabled)
266  {
267  NS_LOG_DEBUG ("FlowMonitor not enabled; returning");
268  return;
269  }
270 
271  probe->AddPacketDropStats (flowId, packetSize, reasonCode);
272 
273  FlowStats &stats = GetStatsForFlow (flowId);
274  stats.lostPackets++;
275  if (stats.packetsDropped.size () < reasonCode + 1)
276  {
277  stats.packetsDropped.resize (reasonCode + 1, 0);
278  stats.bytesDropped.resize (reasonCode + 1, 0);
279  }
280  ++stats.packetsDropped[reasonCode];
281  stats.bytesDropped[reasonCode] += packetSize;
282  NS_LOG_DEBUG ("++stats.packetsDropped[" << reasonCode<< "]; // becomes: " << stats.packetsDropped[reasonCode]);
283 
284  TrackedPacketMap::iterator tracked = m_trackedPackets.find (std::make_pair (flowId, packetId));
285  if (tracked != m_trackedPackets.end ())
286  {
287  // we don't need to track this packet anymore
288  // FIXME: this will not necessarily be true with broadcast/multicast
289  NS_LOG_DEBUG ("ReportDrop: removing tracked packet (flowId="
290  << flowId << ", packetId=" << packetId << ").");
291  m_trackedPackets.erase (tracked);
292  }
293 }
294 
297 {
298  return m_flowStats;
299 }
300 
301 
302 void
304 {
305  NS_LOG_FUNCTION (this << maxDelay.As (Time::S));
306  Time now = Simulator::Now ();
307 
308  for (TrackedPacketMap::iterator iter = m_trackedPackets.begin ();
309  iter != m_trackedPackets.end (); )
310  {
311  if (now - iter->second.lastSeenTime >= maxDelay)
312  {
313  // packet is considered lost, add it to the loss statistics
314  FlowStatsContainerI flow = m_flowStats.find (iter->first.first);
315  NS_ASSERT (flow != m_flowStats.end ());
316  flow->second.lostPackets++;
317 
318  // we won't track it anymore
319  m_trackedPackets.erase (iter++);
320  }
321  else
322  {
323  iter++;
324  }
325  }
326 }
327 
328 void
330 {
332 }
333 
334 void
336 {
339 }
340 
341 void
343 {
346 }
347 
348 void
350 {
351  m_flowProbes.push_back (probe);
352 }
353 
354 
357 {
358  return m_flowProbes;
359 }
360 
361 
362 void
364 {
365  NS_LOG_FUNCTION (this << time.As (Time::S));
366  if (m_enabled)
367  {
368  NS_LOG_DEBUG ("FlowMonitor already enabled; returning");
369  return;
370  }
372  NS_LOG_DEBUG ("Scheduling start at " << time.As (Time::S));
374 }
375 
376 void
377 FlowMonitor::Stop (const Time &time)
378 {
379  NS_LOG_FUNCTION (this << time.As (Time::S));
381  NS_LOG_DEBUG ("Scheduling stop at " << time.As (Time::S));
383 }
384 
385 
386 void
388 {
389  NS_LOG_FUNCTION (this);
390  if (m_enabled)
391  {
392  NS_LOG_DEBUG ("FlowMonitor already enabled; returning");
393  return;
394  }
395  m_enabled = true;
396 }
397 
398 
399 void
401 {
402  NS_LOG_FUNCTION (this);
403  if (!m_enabled)
404  {
405  NS_LOG_DEBUG ("FlowMonitor not enabled; returning");
406  return;
407  }
408  m_enabled = false;
410 }
411 
412 void
414 {
415  m_classifiers.push_back (classifier);
416 }
417 
418 void
419 FlowMonitor::SerializeToXmlStream (std::ostream &os, uint16_t indent, bool enableHistograms, bool enableProbes)
420 {
421  NS_LOG_FUNCTION (this << indent << enableHistograms << enableProbes);
423 
424  os << std::string ( indent, ' ' ) << "<FlowMonitor>\n";
425  indent += 2;
426  os << std::string ( indent, ' ' ) << "<FlowStats>\n";
427  indent += 2;
428  for (FlowStatsContainerCI flowI = m_flowStats.begin ();
429  flowI != m_flowStats.end (); flowI++)
430  {
431  os << std::string ( indent, ' ' );
432 #define ATTRIB(name) << " " # name "=\"" << flowI->second.name << "\""
433  os << "<Flow flowId=\"" << flowI->first << "\""
434  ATTRIB (timeFirstTxPacket)
435  ATTRIB (timeFirstRxPacket)
436  ATTRIB (timeLastTxPacket)
437  ATTRIB (timeLastRxPacket)
438  ATTRIB (delaySum)
439  ATTRIB (jitterSum)
440  ATTRIB (lastDelay)
441  ATTRIB (txBytes)
442  ATTRIB (rxBytes)
443  ATTRIB (txPackets)
444  ATTRIB (rxPackets)
445  ATTRIB (lostPackets)
446  ATTRIB (timesForwarded)
447  << ">\n";
448 #undef ATTRIB
449 
450  indent += 2;
451  for (uint32_t reasonCode = 0; reasonCode < flowI->second.packetsDropped.size (); reasonCode++)
452  {
453  os << std::string ( indent, ' ' );
454  os << "<packetsDropped reasonCode=\"" << reasonCode << "\""
455  << " number=\"" << flowI->second.packetsDropped[reasonCode]
456  << "\" />\n";
457  }
458  for (uint32_t reasonCode = 0; reasonCode < flowI->second.bytesDropped.size (); reasonCode++)
459  {
460  os << std::string ( indent, ' ' );
461  os << "<bytesDropped reasonCode=\"" << reasonCode << "\""
462  << " bytes=\"" << flowI->second.bytesDropped[reasonCode]
463  << "\" />\n";
464  }
465  if (enableHistograms)
466  {
467  flowI->second.delayHistogram.SerializeToXmlStream (os, indent, "delayHistogram");
468  flowI->second.jitterHistogram.SerializeToXmlStream (os, indent, "jitterHistogram");
469  flowI->second.packetSizeHistogram.SerializeToXmlStream (os, indent, "packetSizeHistogram");
470  flowI->second.flowInterruptionsHistogram.SerializeToXmlStream (os, indent, "flowInterruptionsHistogram");
471  }
472  indent -= 2;
473 
474  os << std::string ( indent, ' ' ) << "</Flow>\n";
475  }
476  indent -= 2;
477  os << std::string ( indent, ' ' ) << "</FlowStats>\n";
478 
479  for (std::list<Ptr<FlowClassifier> >::iterator iter = m_classifiers.begin ();
480  iter != m_classifiers.end ();
481  iter ++)
482  {
483  (*iter)->SerializeToXmlStream (os, indent);
484  }
485 
486  if (enableProbes)
487  {
488  os << std::string ( indent, ' ' ) << "<FlowProbes>\n";
489  indent += 2;
490  for (uint32_t i = 0; i < m_flowProbes.size (); i++)
491  {
492  m_flowProbes[i]->SerializeToXmlStream (os, indent, i);
493  }
494  indent -= 2;
495  os << std::string ( indent, ' ' ) << "</FlowProbes>\n";
496  }
497 
498  indent -= 2;
499  os << std::string ( indent, ' ' ) << "</FlowMonitor>\n";
500 }
501 
502 
503 std::string
504 FlowMonitor::SerializeToXmlString (uint16_t indent, bool enableHistograms, bool enableProbes)
505 {
506  NS_LOG_FUNCTION (this << indent << enableHistograms << enableProbes);
507  std::ostringstream os;
508  SerializeToXmlStream (os, indent, enableHistograms, enableProbes);
509  return os.str ();
510 }
511 
512 
513 void
514 FlowMonitor::SerializeToXmlFile (std::string fileName, bool enableHistograms, bool enableProbes)
515 {
516  NS_LOG_FUNCTION (this << fileName << enableHistograms << enableProbes);
517  std::ofstream os (fileName.c_str (), std::ios::out|std::ios::binary);
518  os << "<?xml version=\"1.0\" ?>\n";
519  SerializeToXmlStream (os, 0, enableHistograms, enableProbes);
520  os.close ();
521 }
522 
523 
524 } // namespace ns3
525 
#define PERIODIC_CHECK_INTERVAL
Definition: flow-monitor.cc:28
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:557
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
virtual TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition: flow-monitor.cc:77
void CheckForLostPackets()
Check right now for packets that appear to be lost.
static const uint32_t packetSize
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
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:379
#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:205
const FlowStatsContainer & GetFlowStats() const
Retrieve all collected the flow statistics.
Time m_maxPerHopDelay
Minimum per-hop delay.
Definition: flow-monitor.h:283
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&#39;s associated function will not be invoked when it expires...
Definition: simulator.cc:268
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:346
TimeWithUnit As(const enum Unit unit) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:389
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:296
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...
TrackedPacketMap m_trackedPackets
Tracked packets.
Definition: flow-monitor.h:282
const FlowProbeContainer & GetAllProbes() const
Get a list of all FlowProbe&#39;s associated with this FlowMonitor.
FlowStatsContainer m_flowStats
FlowId –> FlowStats.
Definition: flow-monitor.h:278
Time lastDelay
Contains the last measured delay of a packet It is stored to measure the packet&#39;s Jitter...
Definition: flow-monitor.h:91
def indent(source, debug, level)
Definition: check-style.py:439
std::map< FlowId, FlowStats > FlowStatsContainer
Container: FlowId, FlowStats.
Definition: flow-monitor.h:218
Time firstSeenTime
absolute time when the packet was first seen by a probe
Definition: flow-monitor.h:272
AttributeValue implementation for Time.
Definition: nstime.h:1342
std::list< Ptr< FlowClassifier > > m_classifiers
the FlowClassifiers
Definition: flow-monitor.h:287
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:291
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:294
FlowStats & GetStatsForFlow(FlowId flowId)
Get the stats for a given flow.
double m_jitterBinWidth
Jitter bin width (for histograms)
Definition: flow-monitor.h:293
EventId m_stopEvent
Stop event.
Definition: flow-monitor.h:290
#define list
std::map< FlowId, FlowStats >::const_iterator FlowStatsContainerCI
Container Const Iterator: FlowId, FlowStats.
Definition: flow-monitor.h:222
Time lastSeenTime
absolute time when the packet was last seen by a probe
Definition: flow-monitor.h:273
double m_delayBinWidth
Delay bin width (for histograms)
Definition: flow-monitor.h:292
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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:1343
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
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:220
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:265
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:273
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1278
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:295
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:472
Structure to represent a single tracked packet data.
Definition: flow-monitor.h:270
second
Definition: nstime.h:115
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:289
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 &#39;double&#39; or &#39;float&#39;...
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:274
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:224
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:923
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:284
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