A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
rtt-estimator.h
Go to the documentation of this file.
1//
2// Copyright (c) 2006 Georgia Tech Research Corporation
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: Rajib Bhattacharjea<raj.b@gatech.edu>
18//
19
20// Georgia Tech Network Simulator - Round Trip Time Estimation Class
21// George F. Riley. Georgia Tech, Spring 2002
22
23#ifndef RTT_ESTIMATOR_H
24#define RTT_ESTIMATOR_H
25
26#include "ns3/nstime.h"
27#include "ns3/object.h"
28
29namespace ns3
30{
31
42class RttEstimator : public Object
43{
44 public:
49 static TypeId GetTypeId();
50
56 RttEstimator(const RttEstimator& r);
57
58 ~RttEstimator() override;
59
60 TypeId GetInstanceTypeId() const override;
61
66 virtual void Measurement(Time t) = 0;
67
72 virtual Ptr<RttEstimator> Copy() const = 0;
73
77 virtual void Reset();
78
83 Time GetEstimate() const;
84
93 Time GetVariation() const;
94
99 uint32_t GetNSamples() const;
100
101 private:
103
104 protected:
108};
109
124{
125 public:
130 static TypeId GetTypeId();
131
133
139
140 TypeId GetInstanceTypeId() const override;
141
146 void Measurement(Time measure) override;
147
148 Ptr<RttEstimator> Copy() const override;
149
153 void Reset() override;
154
155 private:
166 uint32_t CheckForReciprocalPowerOfTwo(double val) const;
176 void IntegerUpdate(Time m, uint32_t rttShift, uint32_t variationShift);
185 double m_alpha;
186 double m_beta;
187};
188
189} // namespace ns3
190
191#endif /* RTT_ESTIMATOR_H */
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
Base class for all RTT Estimators.
Definition: rtt-estimator.h:43
Time m_initialEstimatedRtt
Initial RTT estimation.
Time GetEstimate() const
gets the RTT estimate.
virtual void Reset()
Resets the estimation to its initial state.
~RttEstimator() override
Time m_estimatedVariation
Current estimate variation.
uint32_t m_nSamples
Number of samples.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Time m_estimatedRtt
Current estimate.
Time GetVariation() const
Note that this is not a formal statistical variance; it has the the same units as the estimate.
virtual Ptr< RttEstimator > Copy() const =0
Copy object (including current internal state)
virtual void Measurement(Time t)=0
Add a new measurement to the estimator.
static TypeId GetTypeId()
Get the type ID.
uint32_t GetNSamples() const
gets the number of samples used in the estimates
The "Mean--Deviation" RTT estimator, as discussed by Van Jacobson.
double m_beta
Filter gain for variation.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void Reset() override
Resets the estimator.
void FloatingPointUpdate(Time m)
Method to update the rtt and variation estimates using floating point arithmetic, used when the value...
Ptr< RttEstimator > Copy() const override
Copy object (including current internal state)
static TypeId GetTypeId()
Get the type ID.
uint32_t CheckForReciprocalPowerOfTwo(double val) const
Utility function to check for possible conversion of a double value (0 < value < 1) to a reciprocal p...
void Measurement(Time measure) override
Add a new measurement to the estimator.
double m_alpha
Filter gain for average.
void IntegerUpdate(Time m, uint32_t rttShift, uint32_t variationShift)
Method to update the rtt and variation estimates using integer arithmetic, used when the values of Al...
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.