A Discrete-Event Network Simulator
API
flow-probe.h
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 #ifndef FLOW_PROBE_H
22 #define FLOW_PROBE_H
23 
24 #include <map>
25 #include <vector>
26 
27 #include "ns3/object.h"
28 #include "ns3/flow-classifier.h"
29 #include "ns3/nstime.h"
30 
31 namespace ns3 {
32 
33 class FlowMonitor;
34 
39 class FlowProbe : public Object
40 {
41 private:
43  FlowProbe (FlowProbe const &);
46  FlowProbe& operator= (FlowProbe const &);
47 
48 protected:
51  FlowProbe (Ptr<FlowMonitor> flowMonitor);
52  virtual void DoDispose (void);
53 
54 public:
55  virtual ~FlowProbe ();
56 
59  static TypeId GetTypeId (void);
60 
62  struct FlowStats
63  {
65 
67  std::vector<uint32_t> packetsDropped;
69  std::vector<uint64_t> bytesDropped;
74  uint64_t bytes;
76  uint32_t packets;
77  };
78 
80  typedef std::map<FlowId, FlowStats> Stats;
81 
86  void AddPacketStats (FlowId flowId, uint32_t packetSize, Time delayFromFirstProbe);
91  void AddPacketDropStats (FlowId flowId, uint32_t packetSize, uint32_t reasonCode);
92 
97  Stats GetStats () const;
98 
103  void SerializeToXmlStream (std::ostream &os, uint16_t indent, uint32_t index) const;
104 
105 protected:
108 
109 };
110 
111 
112 } // namespace ns3
113 
114 #endif /* FLOW_PROBE_H */
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
static TypeId GetTypeId(void)
Register this type.
Definition: flow-probe.cc:27
std::vector< uint64_t > bytesDropped
bytesDropped[reasonCode] => number of dropped bytes
Definition: flow-probe.h:69
virtual ~FlowProbe()
Definition: flow-probe.cc:38
void AddPacketStats(FlowId flowId, uint32_t packetSize, Time delayFromFirstProbe)
Add a packet data to the flow stats.
Definition: flow-probe.cc:57
Ptr< FlowMonitor > m_flowMonitor
the FlowMonitor instance
Definition: flow-probe.h:106
uint32_t packets
Number of packets seen of this flow.
Definition: flow-probe.h:76
uint64_t bytes
Number of bytes seen of this flow.
Definition: flow-probe.h:74
def indent(source, debug, level)
Definition: check-style.py:424
FlowProbe & operator=(FlowProbe const &)
Defined and not implemented to avoid misuse.
std::vector< uint32_t > packetsDropped
packetsDropped[reasonCode] => number of dropped packets
Definition: flow-probe.h:67
Stats GetStats() const
Get the partial flow statistics stored in this probe.
Definition: flow-probe.cc:80
Structure to hold the statistics of a flow.
Definition: flow-probe.h:62
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void AddPacketDropStats(FlowId flowId, uint32_t packetSize, uint32_t reasonCode)
Add a packet drop data to the flow stats.
Definition: flow-probe.cc:66
The FlowProbe class is responsible for listening for packet events in a specific point of the simulat...
Definition: flow-probe.h:39
Time delayFromFirstProbeSum
divide by &#39;packets&#39; to get the average delay from the first (entry) probe up to this one (partial del...
Definition: flow-probe.h:72
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1014
void SerializeToXmlStream(std::ostream &os, uint16_t indent, uint32_t index) const
Serializes the results to an std::ostream in XML format.
Definition: flow-probe.cc:86
std::map< FlowId, FlowStats > Stats
Container to map FlowId -> FlowStats.
Definition: flow-probe.h:80
static const uint32_t packetSize
A base class which provides memory management and object aggregation.
Definition: object.h:87
FlowProbe(FlowProbe const &)
Defined and not implemented to avoid misuse.
a unique identifier for an interface.
Definition: type-id.h:58
virtual void DoDispose(void)
Destructor implementation.
Definition: flow-probe.cc:50
Stats m_stats
The flow stats.
Definition: flow-probe.h:107
uint32_t FlowId
Abstract identifier of a packet flow.