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 */
A base class which provides memory management and object aggregation.
Definition: object.h:88
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
Base class for all RTT Estimators.
Definition: rtt-estimator.h:43
Time m_initialEstimatedRtt
Initial RTT estimation.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Time GetEstimate(void) const
gets the RTT estimate.
virtual void Reset()
Resets the estimation to its initial state.
Time m_estimatedVariation
Current estimate variation.
uint32_t m_nSamples
Number of samples.
uint32_t GetNSamples(void) const
gets the number of samples used in the estimates
Time GetVariation(void) const
Note that this is not a formal statistical variance; it has the the same units as the estimate.
virtual ~RttEstimator()
Time m_estimatedRtt
Current estimate.
static TypeId GetTypeId(void)
Get the type ID.
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.
The "Mean--Deviation" RTT estimator, as discussed by Van Jacobson.
static TypeId GetTypeId(void)
Get the type ID.
double m_beta
Filter gain for variation.
void Measurement(Time measure)
Add a new measurement to the estimator.
void Reset()
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
Copy object (including current internal state)
uint32_t CheckForReciprocalPowerOfTwo(double val) const
Utility function to check for possible conversion of a double value (0 < value < 1) to a reciprocal p...
double m_alpha
Filter gain for average.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
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:103
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.