A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
flow-probe.h
Go to the documentation of this file.
1//
2// Copyright (c) 2009 INESC Porto
3//
4// This program is free software; you can redistribute it and/or modify
5// it under the terms of the GNU General Public License version 2 as
6// published by the Free Software Foundation;
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with this program; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// Author: Gustavo J. A. M. Carneiro <gjc@inescporto.pt> <gjcarneiro@gmail.com>
18//
19
20#ifndef FLOW_PROBE_H
21#define FLOW_PROBE_H
22
23#include "ns3/flow-classifier.h"
24#include "ns3/nstime.h"
25#include "ns3/object.h"
26
27#include <map>
28#include <vector>
29
30namespace ns3
31{
32
33class FlowMonitor;
34
39class FlowProbe : public Object
40{
41 protected:
44 FlowProbe(Ptr<FlowMonitor> flowMonitor);
45 void DoDispose() override;
46
47 public:
48 ~FlowProbe() override;
49
50 // Delete copy constructor and assignment operator to avoid misuse
51 FlowProbe(const FlowProbe&) = delete;
52 FlowProbe& operator=(const FlowProbe&) = delete;
53
56 static TypeId GetTypeId();
57
59 struct FlowStats
60 {
63 bytes(0),
64 packets(0)
65 {
66 }
67
69 std::vector<uint32_t> packetsDropped;
71 std::vector<uint64_t> bytesDropped;
76 uint64_t bytes;
79 };
80
82 typedef std::map<FlowId, FlowStats> Stats;
83
88 void AddPacketStats(FlowId flowId, uint32_t packetSize, Time delayFromFirstProbe);
93 void AddPacketDropStats(FlowId flowId, uint32_t packetSize, uint32_t reasonCode);
94
99 Stats GetStats() const;
100
105 void SerializeToXmlStream(std::ostream& os, uint16_t indent, uint32_t index) const;
106
107 protected:
110};
111
112} // namespace ns3
113
114#endif /* FLOW_PROBE_H */
The FlowProbe class is responsible for listening for packet events in a specific point of the simulat...
Definition: flow-probe.h:40
FlowProbe & operator=(const FlowProbe &)=delete
Stats m_stats
The flow stats.
Definition: flow-probe.h:109
void AddPacketStats(FlowId flowId, uint32_t packetSize, Time delayFromFirstProbe)
Add a packet data to the flow stats.
Definition: flow-probe.cc:56
void DoDispose() override
Destructor implementation.
Definition: flow-probe.cc:49
void AddPacketDropStats(FlowId flowId, uint32_t packetSize, uint32_t reasonCode)
Add a packet drop data to the flow stats.
Definition: flow-probe.cc:65
std::map< FlowId, FlowStats > Stats
Container to map FlowId -> FlowStats.
Definition: flow-probe.h:82
Stats GetStats() const
Get the partial flow statistics stored in this probe.
Definition: flow-probe.cc:79
FlowProbe(const FlowProbe &)=delete
static TypeId GetTypeId()
Register this type.
Definition: flow-probe.cc:29
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:85
Ptr< FlowMonitor > m_flowMonitor
the FlowMonitor instance
Definition: flow-probe.h:108
~FlowProbe() override
Definition: flow-probe.cc:38
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Structure to hold the statistics of a flow.
Definition: flow-probe.h:60
uint64_t bytes
Number of bytes seen of this flow.
Definition: flow-probe.h:76
uint32_t packets
Number of packets seen of this flow.
Definition: flow-probe.h:78
Time delayFromFirstProbeSum
divide by 'packets' to get the average delay from the first (entry) probe up to this one (partial del...
Definition: flow-probe.h:74
std::vector< uint32_t > packetsDropped
packetsDropped[reasonCode] => number of dropped packets
Definition: flow-probe.h:69
std::vector< uint64_t > bytesDropped
bytesDropped[reasonCode] => number of dropped bytes
Definition: flow-probe.h:71
static const uint32_t packetSize
Packet size generated at the AP.