A Discrete-Event Network Simulator
API
rtt-estimator.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 //
3 // Copyright (c) 2006 Georgia Tech Research Corporation
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: Rajib Bhattacharjea<raj.b@gatech.edu>
19 //
20 
21 // Georgia Tech Network Simulator - Round Trip Time Estimation Class
22 // George F. Riley. Georgia Tech, Spring 2002
23 
24 
25 #ifndef RTT_ESTIMATOR_H
26 #define RTT_ESTIMATOR_H
27 
28 #include "ns3/nstime.h"
29 #include "ns3/object.h"
30 
31 namespace ns3 {
32 
43 class RttEstimator : public Object {
44 public:
49  static TypeId GetTypeId (void);
50 
51  RttEstimator();
56  RttEstimator (const RttEstimator& r);
57 
58  virtual ~RttEstimator();
59 
60  virtual TypeId GetInstanceTypeId (void) const;
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 (void) const;
84 
93  Time GetVariation (void) const;
94 
99  uint32_t GetNSamples (void) const;
100 
101 private:
103 
104 protected:
107  uint32_t m_nSamples;
108 };
109 
124 public:
129  static TypeId GetTypeId (void);
130 
131  RttMeanDeviation ();
132 
138 
139  virtual TypeId GetInstanceTypeId (void) const;
140 
145  void Measurement (Time measure);
146 
147  Ptr<RttEstimator> Copy () const;
148 
152  void Reset ();
153 
154 private:
165  uint32_t CheckForReciprocalPowerOfTwo (double val) const;
175  void IntegerUpdate (Time m, uint32_t rttShift, uint32_t variationShift);
183  void FloatingPointUpdate (Time m);
184  double m_alpha;
185  double m_beta;
186 
187 };
188 
189 } // namespace ns3
190 
191 #endif /* RTT_ESTIMATOR_H */
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::RttEstimator::Reset
virtual void Reset()
Resets the estimation to its initial state.
Definition: rtt-estimator.cc:108
ns3::RttMeanDeviation::Reset
void Reset()
Resets the estimator.
Definition: rtt-estimator.cc:276
ns3::RttEstimator::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: rtt-estimator.cc:45
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::RttEstimator
Base class for all RTT Estimators.
Definition: rtt-estimator.h:43
ns3::RttEstimator::m_estimatedVariation
Time m_estimatedVariation
Current estimate variation.
Definition: rtt-estimator.h:106
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:219
ns3::RttMeanDeviation::m_alpha
double m_alpha
Filter gain for average.
Definition: rtt-estimator.h:184
ns3::RttMeanDeviation::Measurement
void Measurement(Time measure)
Add a new measurement to the estimator.
Definition: rtt-estimator.cc:239
ns3::RttEstimator::GetVariation
Time GetVariation(void) const
Note that this is not a formal statistical variance; it has the the same units as the estimate.
Definition: rtt-estimator.cc:66
ns3::RttEstimator::RttEstimator
RttEstimator()
Definition: rtt-estimator.cc:74
ns3::RttMeanDeviation::Copy
Ptr< RttEstimator > Copy() const
Copy object (including current internal state)
Definition: rtt-estimator.cc:269
ns3::RttMeanDeviation
The "Mean--Deviation" RTT estimator, as discussed by Van Jacobson.
Definition: rtt-estimator.h:123
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
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:168
ns3::RttEstimator::m_initialEstimatedRtt
Time m_initialEstimatedRtt
Initial RTT estimation.
Definition: rtt-estimator.h:102
ns3::Object
A base class which provides memory management and object aggregation.
Definition: object.h:88
ns3::RttMeanDeviation::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: rtt-estimator.cc:130
ns3::RttMeanDeviation::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: rtt-estimator.cc:162
ns3::RttEstimator::Copy
virtual Ptr< RttEstimator > Copy() const =0
Copy object (including current internal state)
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
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:200
ns3::RttEstimator::Measurement
virtual void Measurement(Time t)=0
Add a new measurement to the estimator.
ns3::RttEstimator::m_nSamples
uint32_t m_nSamples
Number of samples.
Definition: rtt-estimator.h:107
ns3::RttMeanDeviation::m_beta
double m_beta
Filter gain for variation.
Definition: rtt-estimator.h:185
ns3::RttEstimator::m_estimatedRtt
Time m_estimatedRtt
Current estimate.
Definition: rtt-estimator.h:105
ns3::RttEstimator::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: rtt-estimator.cc:103
ns3::RttEstimator::GetEstimate
Time GetEstimate(void) const
gets the RTT estimate.
Definition: rtt-estimator.cc:60
ns3::RttEstimator::~RttEstimator
virtual ~RttEstimator()
Definition: rtt-estimator.cc:97
ns3::RttMeanDeviation::RttMeanDeviation
RttMeanDeviation()
Definition: rtt-estimator.cc:150
ns3::RttEstimator::GetNSamples
uint32_t GetNSamples(void) const
gets the number of samples used in the estimates
Definition: rtt-estimator.cc:118