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 #define ATTRIB_TIME(name) << " " #name "=\"" << flowI->second.name.As (Time::NS) << "\""
434  os << "<Flow flowId=\"" << flowI->first << "\""
435  ATTRIB_TIME (timeFirstTxPacket)
436  ATTRIB_TIME (timeFirstRxPacket)
437  ATTRIB_TIME (timeLastTxPacket)
438  ATTRIB_TIME (timeLastRxPacket)
439  ATTRIB_TIME (delaySum)
440  ATTRIB_TIME (jitterSum)
441  ATTRIB_TIME (lastDelay)
442  ATTRIB (txBytes)
443  ATTRIB (rxBytes)
444  ATTRIB (txPackets)
445  ATTRIB (rxPackets)
446  ATTRIB (lostPackets)
447  ATTRIB (timesForwarded)
448  << ">\n";
449 #undef ATTRIB_TIME
450 #undef ATTRIB
451 
452  indent += 2;
453  for (uint32_t reasonCode = 0; reasonCode < flowI->second.packetsDropped.size (); reasonCode++)
454  {
455  os << std::string ( indent, ' ' );
456  os << "<packetsDropped reasonCode=\"" << reasonCode << "\""
457  << " number=\"" << flowI->second.packetsDropped[reasonCode]
458  << "\" />\n";
459  }
460  for (uint32_t reasonCode = 0; reasonCode < flowI->second.bytesDropped.size (); reasonCode++)
461  {
462  os << std::string ( indent, ' ' );
463  os << "<bytesDropped reasonCode=\"" << reasonCode << "\""
464  << " bytes=\"" << flowI->second.bytesDropped[reasonCode]
465  << "\" />\n";
466  }
467  if (enableHistograms)
468  {
469  flowI->second.delayHistogram.SerializeToXmlStream (os, indent, "delayHistogram");
470  flowI->second.jitterHistogram.SerializeToXmlStream (os, indent, "jitterHistogram");
471  flowI->second.packetSizeHistogram.SerializeToXmlStream (os, indent, "packetSizeHistogram");
472  flowI->second.flowInterruptionsHistogram.SerializeToXmlStream (os, indent, "flowInterruptionsHistogram");
473  }
474  indent -= 2;
475 
476  os << std::string ( indent, ' ' ) << "</Flow>\n";
477  }
478  indent -= 2;
479  os << std::string ( indent, ' ' ) << "</FlowStats>\n";
480 
481  for (std::list<Ptr<FlowClassifier> >::iterator iter = m_classifiers.begin ();
482  iter != m_classifiers.end ();
483  iter ++)
484  {
485  (*iter)->SerializeToXmlStream (os, indent);
486  }
487 
488  if (enableProbes)
489  {
490  os << std::string ( indent, ' ' ) << "<FlowProbes>\n";
491  indent += 2;
492  for (uint32_t i = 0; i < m_flowProbes.size (); i++)
493  {
494  m_flowProbes[i]->SerializeToXmlStream (os, indent, i);
495  }
496  indent -= 2;
497  os << std::string ( indent, ' ' ) << "</FlowProbes>\n";
498  }
499 
500  indent -= 2;
501  os << std::string ( indent, ' ' ) << "</FlowMonitor>\n";
502 }
503 
504 
505 std::string
506 FlowMonitor::SerializeToXmlString (uint16_t indent, bool enableHistograms, bool enableProbes)
507 {
508  NS_LOG_FUNCTION (this << indent << enableHistograms << enableProbes);
509  std::ostringstream os;
510  SerializeToXmlStream (os, indent, enableHistograms, enableProbes);
511  return os.str ();
512 }
513 
514 
515 void
516 FlowMonitor::SerializeToXmlFile (std::string fileName, bool enableHistograms, bool enableProbes)
517 {
518  NS_LOG_FUNCTION (this << fileName << enableHistograms << enableProbes);
519  std::ofstream os (fileName.c_str (), std::ios::out|std::ios::binary);
520  os << "<?xml version=\"1.0\" ?>\n";
521  SerializeToXmlStream (os, 0, enableHistograms, enableProbes);
522  os.close ();
523 }
524 
525 
526 } // namespace ns3
527 
ns3::FlowMonitor::AddProbe
void AddProbe(Ptr< FlowProbe > probe)
Register a new FlowProbe that will begin monitoring and report events to this monitor.
Definition: flow-monitor.cc:349
ns3::FlowMonitor::TrackedPacket
Structure to represent a single tracked packet data.
Definition: flow-monitor.h:271
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::FlowMonitor::FlowStats::delaySum
Time delaySum
Contains the sum of all end-to-end delays for all received packets of the flow.
Definition: flow-monitor.h:78
ns3::FlowMonitor::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition: flow-monitor.cc:37
ns3::FlowMonitor::StartRightNow
void StartRightNow()
Begin monitoring flows right now
Definition: flow-monitor.cc:387
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
NS_ASSERT
#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
ns3::FlowMonitor::FlowStats::bytesDropped
std::vector< uint64_t > bytesDropped
This attribute also tracks the number of lost bytes.
Definition: flow-monitor.h:136
ns3::MakeTimeChecker
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:533
ns3::FlowProbe::AddPacketDropStats
void AddPacketDropStats(FlowId flowId, uint32_t packetSize, uint32_t reasonCode)
Add a packet drop data to the flow stats.
Definition: flow-probe.cc:66
ns3::FlowMonitor::m_maxPerHopDelay
Time m_maxPerHopDelay
Minimum per-hop delay.
Definition: flow-monitor.h:283
ns3::Simulator::Now
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::FlowMonitor::ReportFirstTx
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...
Definition: flow-monitor.cc:140
ATTRIB_TIME
#define ATTRIB_TIME(name)
ns3::FlowMonitor::m_flowProbes
FlowProbeContainer m_flowProbes
all the FlowProbes
Definition: flow-monitor.h:284
ns3::FlowMonitor::FlowStats::timeLastRxPacket
Time timeLastRxPacket
Contains the absolute time when the last packet in the flow was received, i.e.
Definition: flow-monitor.h:74
ns3::FlowMonitor::NotifyConstructionCompleted
virtual void NotifyConstructionCompleted()
Notifier called once the ObjectBase is fully constructed.
Definition: flow-monitor.cc:342
ns3::FlowProbe::AddPacketStats
void AddPacketStats(FlowId flowId, uint32_t packetSize, Time delayFromFirstProbe)
Add a packet data to the flow stats.
Definition: flow-probe.cc:57
NS_LOG_WARN
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:265
ns3::FlowMonitor::FlowStats::rxBytes
uint64_t rxBytes
Total number of received bytes for the flow.
Definition: flow-monitor.h:96
ns3::FlowMonitor::FlowStats::lostPackets
uint32_t lostPackets
Total number of packets that are assumed to be lost, i.e.
Definition: flow-monitor.h:107
ns3::FlowMonitor::ReportDrop
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...
Definition: flow-monitor.cc:261
ns3::FlowMonitor::m_trackedPackets
TrackedPacketMap m_trackedPackets
Tracked packets.
Definition: flow-monitor.h:282
ns3::FlowMonitor::m_delayBinWidth
double m_delayBinWidth
Delay bin width (for histograms)
Definition: flow-monitor.h:292
ns3::FlowMonitor::ReportLastRx
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...
Definition: flow-monitor.cc:196
ns3::Time::As
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:429
ns3::FlowMonitor::m_enabled
bool m_enabled
FlowMon is enabled.
Definition: flow-monitor.h:291
ns3::FlowMonitor::TrackedPacket::timesForwarded
uint32_t timesForwarded
number of times the packet was reportedly forwarded
Definition: flow-monitor.h:274
ns3::FlowMonitor::m_startEvent
EventId m_startEvent
Start event.
Definition: flow-monitor.h:289
ns3::Simulator::Schedule
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:556
ns3::FlowMonitor::FlowStats::txBytes
uint64_t txBytes
Total number of transmitted bytes for the flow.
Definition: flow-monitor.h:94
ns3::FlowMonitor::SerializeToXmlString
std::string SerializeToXmlString(uint16_t indent, bool enableHistograms, bool enableProbes)
Same as SerializeToXmlStream, but returns the output as a std::string.
Definition: flow-monitor.cc:506
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
flow-monitor.h
ns3::FlowMonitor::FlowStats::lastDelay
Time lastDelay
Contains the last measured delay of a packet It is stored to measure the packet's Jitter.
Definition: flow-monitor.h:91
ns3::FlowMonitor::FlowStats::jitterHistogram
Histogram jitterHistogram
Histogram of the packet jitters.
Definition: flow-monitor.h:116
ns3::FlowId
uint32_t FlowId
Abstract identifier of a packet flow.
Definition: flow-classifier.h:33
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::FlowMonitor::FlowStats::rxPackets
uint32_t rxPackets
Total number of received packets for the flow.
Definition: flow-monitor.h:100
ns3::FlowMonitor::FlowStatsContainer
std::map< FlowId, FlowStats > FlowStatsContainer
Container: FlowId, FlowStats.
Definition: flow-monitor.h:218
check-style.indent
def indent(source, debug, level)
Definition: check-style.py:435
ns3::FlowMonitor::FlowStats::flowInterruptionsHistogram
Histogram flowInterruptionsHistogram
histogram of durations of flow interruptions
Definition: flow-monitor.h:137
ns3::Object
A base class which provides memory management and object aggregation.
Definition: object.h:88
ns3::Simulator::Cancel
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:268
ns3::FlowMonitor::GetAllProbes
const FlowProbeContainer & GetAllProbes() const
Get a list of all FlowProbe's associated with this FlowMonitor.
Definition: flow-monitor.cc:356
ns3::FlowMonitor::FlowProbeContainer
std::vector< Ptr< FlowProbe > > FlowProbeContainer
Container: FlowProbe.
Definition: flow-monitor.h:224
ns3::FlowMonitor::FlowStatsContainerCI
std::map< FlowId, FlowStats >::const_iterator FlowStatsContainerCI
Container Const Iterator: FlowId, FlowStats.
Definition: flow-monitor.h:222
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::FlowMonitor::FlowStats::packetSizeHistogram
Histogram packetSizeHistogram
Histogram of the packet sizes.
Definition: flow-monitor.h:118
ns3::FlowMonitor::m_jitterBinWidth
double m_jitterBinWidth
Jitter bin width (for histograms)
Definition: flow-monitor.h:293
ns3::FlowMonitor
An object that monitors and reports back packet flows observed during a simulation.
Definition: flow-monitor.h:51
list
#define list
Definition: openflow-interface.h:47
ns3::FlowMonitor::Stop
void Stop(const Time &time)
Set the time, counting from the current time, from which to stop monitoring flows.
Definition: flow-monitor.cc:377
ns3::FlowMonitor::TrackedPacket::firstSeenTime
Time firstSeenTime
absolute time when the packet was first seen by a probe
Definition: flow-monitor.h:272
ns3::FlowMonitor::m_stopEvent
EventId m_stopEvent
Stop event.
Definition: flow-monitor.h:290
ns3::MakeDoubleAccessor
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
ATTRIB
#define ATTRIB(name)
ns3::FlowMonitor::StopRightNow
void StopRightNow()
End monitoring flows right now
Definition: flow-monitor.cc:400
ns3::FlowMonitor::m_packetSizeBinWidth
double m_packetSizeBinWidth
packet size bin width (for histograms)
Definition: flow-monitor.h:294
ns3::FlowMonitor::FlowStats::packetsDropped
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
ns3::FlowMonitor::FlowStats::delayHistogram
Histogram delayHistogram
Histogram of the packet delays.
Definition: flow-monitor.h:114
ns3::FlowMonitor::FlowStats::timeFirstTxPacket
Time timeFirstTxPacket
Contains the absolute time when the first packet in the flow was transmitted, i.e.
Definition: flow-monitor.h:60
packetSize
static const uint32_t packetSize
Definition: wifi-power-adaptation-distance.cc:113
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
ns3::Time::S
@ S
second
Definition: nstime.h:115
ns3::FlowMonitor::GetStatsForFlow
FlowStats & GetStatsForFlow(FlowId flowId)
Get the stats for a given flow.
Definition: flow-monitor.cc:109
ns3::FlowMonitor::FlowMonitor
FlowMonitor()
Definition: flow-monitor.cc:82
ns3::Histogram::AddValue
void AddValue(double value)
Add a value to the histogram.
Definition: histogram.cc:80
ns3::TimeValue
AttributeValue implementation for Time.
Definition: nstime.h:1353
ns3::FlowMonitor::FlowStatsContainerI
std::map< FlowId, FlowStats >::iterator FlowStatsContainerI
Container Iterator: FlowId, FlowStats.
Definition: flow-monitor.h:220
ns3::FlowMonitor::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition: flow-monitor.cc:89
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::FlowMonitor::PeriodicCheckForLostPackets
void PeriodicCheckForLostPackets()
Periodic function to check for lost packets and prune statistics.
Definition: flow-monitor.cc:335
ns3::FlowMonitor::TrackedPacket::lastSeenTime
Time lastSeenTime
absolute time when the packet was last seen by a probe
Definition: flow-monitor.h:273
ns3::FlowMonitor::FlowStats::jitterSum
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
ns3::FlowMonitor::FlowStats::timeLastTxPacket
Time timeLastTxPacket
Contains the absolute time when the last packet in the flow was transmitted, i.e.
Definition: flow-monitor.h:70
ns3::FlowMonitor::FlowStats::txPackets
uint32_t txPackets
Total number of transmitted packets for the flow.
Definition: flow-monitor.h:98
ns3::FlowMonitor::AddFlowClassifier
void AddFlowClassifier(Ptr< FlowClassifier > classifier)
Add a FlowClassifier to be used by the flow monitor.
Definition: flow-monitor.cc:413
ns3::FlowMonitor::Start
void Start(const Time &time)
Set the time, counting from the current time, from which to start monitoring flows.
Definition: flow-monitor.cc:363
ns3::FlowMonitor::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition: flow-monitor.cc:77
ns3::FlowMonitor::m_flowInterruptionsMinTime
Time m_flowInterruptionsMinTime
Flow interruptions minimum time.
Definition: flow-monitor.h:296
ns3::Histogram::SetDefaultBinWidth
void SetDefaultBinWidth(double binWidth)
Set the bin width.
Definition: histogram.cc:66
ns3::FlowMonitor::SerializeToXmlStream
void SerializeToXmlStream(std::ostream &os, uint16_t indent, bool enableHistograms, bool enableProbes)
Serializes the results to an std::ostream in XML format.
Definition: flow-monitor.cc:419
ns3::FlowMonitor::m_flowInterruptionsBinWidth
double m_flowInterruptionsBinWidth
Flow interruptions bin width (for histograms)
Definition: flow-monitor.h:295
ns3::FlowMonitor::m_flowStats
FlowStatsContainer m_flowStats
FlowId --> FlowStats.
Definition: flow-monitor.h:278
ns3::FlowMonitor::GetFlowStats
const FlowStatsContainer & GetFlowStats() const
Retrieve all collected the flow statistics.
Definition: flow-monitor.cc:296
ns3::FlowMonitor::FlowStats::timesForwarded
uint32_t timesForwarded
Contains the number of times a packet has been reportedly forwarded, summed for all received packets ...
Definition: flow-monitor.h:111
ns3::FlowMonitor::FlowStats
Structure that represents the measured metrics of an individual packet flow.
Definition: flow-monitor.h:56
ns3::FlowMonitor::CheckForLostPackets
void CheckForLostPackets()
Check right now for packets that appear to be lost.
Definition: flow-monitor.cc:329
ns3::Object::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:346
ns3::FlowMonitor::FlowStats::timeFirstRxPacket
Time timeFirstRxPacket
Contains the absolute time when the first packet in the flow was received by an end node,...
Definition: flow-monitor.h:65
ns3::Time::GetSeconds
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:380
PERIODIC_CHECK_INTERVAL
#define PERIODIC_CHECK_INTERVAL
Definition: flow-monitor.cc:28
ns3::MakeTimeAccessor
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:1354
ns3::ObjectBase::NotifyConstructionCompleted
virtual void NotifyConstructionCompleted(void)
Notifier called once the ObjectBase is fully constructed.
Definition: object-base.cc:74
ns3::FlowMonitor::SerializeToXmlFile
void SerializeToXmlFile(std::string fileName, bool enableHistograms, bool enableProbes)
Same as SerializeToXmlStream, but writes to a file instead.
Definition: flow-monitor.cc:516
ns3::FlowMonitor::ReportForwarding
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...
Definition: flow-monitor.cc:170
ns3::FlowMonitor::m_classifiers
std::list< Ptr< FlowClassifier > > m_classifiers
the FlowClassifiers
Definition: flow-monitor.h:287