A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
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
// SPDX-License-Identifier: GPL-2.0-only
5
//
6
// Author: Rajib Bhattacharjea<raj.b@gatech.edu>
7
//
8
9
// Georgia Tech Network Simulator - Round Trip Time Estimation Class
10
// George F. Riley. Georgia Tech, Spring 2002
11
12
#ifndef RTT_ESTIMATOR_H
13
#define RTT_ESTIMATOR_H
14
15
#include "ns3/nstime.h"
16
#include "ns3/object.h"
17
18
namespace
ns3
19
{
20
21
/**
22
* @ingroup tcp
23
*
24
* @brief Base class for all RTT Estimators
25
*
26
* The RTT Estimator class computes an estimate of the round trip time
27
* observed in a series of Time measurements. The estimate is provided in
28
* the form of an estimate and a sample variation. Subclasses can implement
29
* different algorithms to provide values for the estimate and variation.
30
*/
31
class
RttEstimator
:
public
Object
32
{
33
public
:
34
/**
35
* @brief Get the type ID.
36
* @return the object TypeId
37
*/
38
static
TypeId
GetTypeId
();
39
40
RttEstimator
();
41
/**
42
* @brief Copy constructor
43
* @param r the object to copy
44
*/
45
RttEstimator
(
const
RttEstimator
& r);
46
47
~RttEstimator
()
override
;
48
49
/**
50
* @brief Add a new measurement to the estimator. Pure virtual function.
51
* @param t the new RTT measure.
52
*/
53
virtual
void
Measurement
(
Time
t) = 0;
54
55
/**
56
* @brief Copy object (including current internal state)
57
* @returns a copy of itself
58
*/
59
virtual
Ptr<RttEstimator>
Copy
()
const
= 0;
60
61
/**
62
* @brief Resets the estimation to its initial state.
63
*/
64
virtual
void
Reset
();
65
66
/**
67
* @brief gets the RTT estimate.
68
* @return The RTT estimate.
69
*/
70
Time
GetEstimate
()
const
;
71
72
/**
73
* Note that this is not a formal statistical variance; it has the
74
* the same units as the estimate. Mean deviation or standard deviation
75
* are example quantities that could be provided here.
76
*
77
* @brief gets the RTT estimate variation.
78
* @return The RTT estimate variation.
79
*/
80
Time
GetVariation
()
const
;
81
82
/**
83
* @brief gets the number of samples used in the estimates
84
* @return the number of samples used in the estimates
85
*/
86
uint32_t
GetNSamples
()
const
;
87
88
private
:
89
Time
m_initialEstimatedRtt
;
//!< Initial RTT estimation
90
91
protected
:
92
Time
m_estimatedRtt
;
//!< Current estimate
93
Time
m_estimatedVariation
;
//!< Current estimate variation
94
uint32_t
m_nSamples
;
//!< Number of samples
95
};
96
97
/**
98
* @ingroup tcp
99
*
100
* @brief The "Mean--Deviation" RTT estimator, as discussed by Van Jacobson
101
*
102
* This class implements the "Mean--Deviation" RTT estimator, as discussed
103
* by Van Jacobson and Michael J. Karels, in
104
* "Congestion Avoidance and Control", SIGCOMM 88, Appendix A
105
*
106
* The default values for the gain (alpha and beta) are set as documented
107
* in RFC 6298.
108
*
109
*/
110
class
RttMeanDeviation
:
public
RttEstimator
111
{
112
public
:
113
/**
114
* @brief Get the type ID.
115
* @return the object TypeId
116
*/
117
static
TypeId
GetTypeId
();
118
119
RttMeanDeviation
();
120
121
/**
122
* @brief Copy constructor
123
* @param r the object to copy
124
*/
125
RttMeanDeviation
(
const
RttMeanDeviation
& r);
126
127
/**
128
* @brief Add a new measurement to the estimator.
129
* @param measure the new RTT measure.
130
*/
131
void
Measurement
(
Time
measure)
override
;
132
133
Ptr<RttEstimator>
Copy
()
const override
;
134
135
/**
136
* @brief Resets the estimator.
137
*/
138
void
Reset
()
override
;
139
140
private
:
141
/**
142
* Utility function to check for possible conversion
143
* of a double value (0 < value < 1) to a reciprocal power of two
144
*
145
* Values of 1/32, 1/16, 1/8, 1/4, and 1/2 (i.e., within the possible
146
* range of experimentation for this estimator) are supported.
147
*
148
* @param val value to check
149
* @return log base 2 (1/val) if reciprocal power of 2, or zero if not
150
*/
151
uint32_t
CheckForReciprocalPowerOfTwo
(
double
val)
const
;
152
/**
153
* Method to update the rtt and variation estimates using integer
154
* arithmetic, used when the values of Alpha and Beta support the
155
* integer conversion.
156
*
157
* @param m time measurement
158
* @param rttShift value corresponding to log base 2 (1/alpha)
159
* @param variationShift value corresponding to log base 2 (1/beta)
160
*/
161
void
IntegerUpdate
(
Time
m,
uint32_t
rttShift,
uint32_t
variationShift);
162
/**
163
* Method to update the rtt and variation estimates using floating
164
* point arithmetic, used when the values of Alpha and Beta are not
165
* both a reciprocal power of two.
166
*
167
* @param m time measurement
168
*/
169
void
FloatingPointUpdate
(
Time
m);
170
double
m_alpha
;
//!< Filter gain for average
171
double
m_beta
;
//!< Filter gain for variation
172
};
173
174
}
// namespace ns3
175
176
#endif
/* RTT_ESTIMATOR_H */
ns3::Object::Object
Object()
Constructor.
Definition
object.cc:96
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
ptr.h:66
ns3::RttEstimator::m_initialEstimatedRtt
Time m_initialEstimatedRtt
Initial RTT estimation.
Definition
rtt-estimator.h:89
ns3::RttEstimator::GetEstimate
Time GetEstimate() const
gets the RTT estimate.
Definition
rtt-estimator.cc:49
ns3::RttEstimator::Reset
virtual void Reset()
Resets the estimation to its initial state.
Definition
rtt-estimator.cc:91
ns3::RttEstimator::~RttEstimator
~RttEstimator() override
Definition
rtt-estimator.cc:85
ns3::RttEstimator::m_estimatedVariation
Time m_estimatedVariation
Current estimate variation.
Definition
rtt-estimator.h:93
ns3::RttEstimator::m_nSamples
uint32_t m_nSamples
Number of samples.
Definition
rtt-estimator.h:94
ns3::RttEstimator::RttEstimator
RttEstimator()
Definition
rtt-estimator.cc:62
ns3::RttEstimator::m_estimatedRtt
Time m_estimatedRtt
Current estimate.
Definition
rtt-estimator.h:92
ns3::RttEstimator::GetVariation
Time GetVariation() const
Note that this is not a formal statistical variance; it has the the same units as the estimate.
Definition
rtt-estimator.cc:55
ns3::RttEstimator::Copy
virtual Ptr< RttEstimator > Copy() const =0
Copy object (including current internal state)
ns3::RttEstimator::Measurement
virtual void Measurement(Time t)=0
Add a new measurement to the estimator.
ns3::RttEstimator::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
rtt-estimator.cc:35
ns3::RttEstimator::GetNSamples
uint32_t GetNSamples() const
gets the number of samples used in the estimates
Definition
rtt-estimator.cc:101
ns3::RttMeanDeviation::m_beta
double m_beta
Filter gain for variation.
Definition
rtt-estimator.h:171
ns3::RttMeanDeviation::RttMeanDeviation
RttMeanDeviation()
Definition
rtt-estimator.cc:133
ns3::RttMeanDeviation::Reset
void Reset() override
Resets the estimator.
Definition
rtt-estimator.cc:253
ns3::RttMeanDeviation::FloatingPointUpdate
void FloatingPointUpdate(Time m)
Method to update the rtt and variation estimates using floating point arithmetic, used when the value...
Definition
rtt-estimator.cc:179
ns3::RttMeanDeviation::Copy
Ptr< RttEstimator > Copy() const override
Copy object (including current internal state)
Definition
rtt-estimator.cc:246
ns3::RttMeanDeviation::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
rtt-estimator.cc:113
ns3::RttMeanDeviation::CheckForReciprocalPowerOfTwo
uint32_t CheckForReciprocalPowerOfTwo(double val) const
Utility function to check for possible conversion of a double value (0 < value < 1) to a reciprocal p...
Definition
rtt-estimator.cc:147
ns3::RttMeanDeviation::Measurement
void Measurement(Time measure) override
Add a new measurement to the estimator.
Definition
rtt-estimator.cc:216
ns3::RttMeanDeviation::m_alpha
double m_alpha
Filter gain for average.
Definition
rtt-estimator.h:170
ns3::RttMeanDeviation::IntegerUpdate
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...
Definition
rtt-estimator.cc:197
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:49
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
internet
model
rtt-estimator.h
Generated on Wed Jun 11 2025 13:15:30 for ns-3 by
1.13.2