29 #include "ns3/simulator.h" 
   30 #include "ns3/double.h" 
   31 #include "ns3/integer.h" 
   32 #include "ns3/uinteger.h" 
   35 NS_LOG_COMPONENT_DEFINE(
"ndn.RttMeanDeviation");
 
   49     TypeId(
"ns3::ndn::RttMeanDeviation")
 
   51       .AddConstructor<RttMeanDeviation>()
 
   52       .AddAttribute(
"Gain", 
"Gain used in estimating the RTT (smoothed RTT), must be 0 < Gain < 1",
 
   53                     DoubleValue(0.125), MakeDoubleAccessor(&RttMeanDeviation::m_gain),
 
   54                     MakeDoubleChecker<double>())
 
   55       .AddAttribute(
"Gain2", 
"Gain2 used in estimating the RTT (variance), must be 0 < Gain2 < 1",
 
   56                     DoubleValue(0.25), MakeDoubleAccessor(&RttMeanDeviation::m_gain2),
 
   57                     MakeDoubleChecker<double>());
 
   64   NS_LOG_FUNCTION(
this);
 
   71   , m_variance(c.m_variance)
 
   73   NS_LOG_FUNCTION(
this);
 
   85   NS_LOG_FUNCTION(
this << m);
 
   88     double gErr = err.ToDouble(Time::S) * m_gain;
 
   90     Time difference = Abs(err) - m_variance;
 
   92       "m_variance += " << Time::FromDouble(difference.ToDouble(Time::S) * m_gain2, Time::S));
 
   93     m_variance += Time::FromDouble(difference.ToDouble(Time::S) * m_gain2, Time::S);
 
   99     m_variance = Seconds(m.ToDouble(Time::S) / 2);
 
  100     NS_LOG_DEBUG(
"(first sample) m_variance += " << m);
 
  108   NS_LOG_FUNCTION(
this);
 
  110   double retval = std::min(
m_maxRto.ToDouble(Time::S),
 
  113                                                     + 4 * m_variance.ToDouble(Time::S))));
 
  115   NS_LOG_DEBUG(
"RetransmitTimeout:  return " << retval);
 
  117   return Seconds(retval);
 
  123   NS_LOG_FUNCTION(
this);
 
  124   return CopyObject<RttMeanDeviation>(
this);
 
  130   NS_LOG_FUNCTION(
this);
 
  132   m_variance = Seconds(0);
 
  139   NS_LOG_FUNCTION(
this);
 
  140   NS_ASSERT_MSG((g > 0) && (g < 1),
 
  141                 "RttMeanDeviation: Gain must be less than 1 and greater than 0");
 
  148   NS_LOG_FUNCTION(
this << seq << size);
 
  150   RttHistory_t::iterator i;
 
  166   NS_LOG_FUNCTION(
this << ackSeq);
 
  170   Time m = Seconds(0.0);
 
  175     if (ackSeq == i->seq) { 
 
  177         m = Simulator::Now() - i->time; 
 
void SentSeq(SequenceNumber32 seq, uint32_t size)
Note that a particular sequence has been sent. 
 
virtual TypeId GetInstanceTypeId(void) const 
 
The modified version of "Mean--Deviation" RTT estimator, as discussed by Van Jacobson that better sui...
 
NS_OBJECT_ENSURE_REGISTERED(ContentStore)
 
Time RetransmitTimeout()
Returns the estimated RTO. 
 
Ptr< RttEstimator > Copy() const 
 
virtual void Reset()
Resets the estimation to its initial state. 
 
void Reset()
Resets the estimation to its initial state. 
 
virtual void ResetMultiplier()
Resets the estimation multiplier to 1. 
 
Time AckSeq(SequenceNumber32 ackSeq)
Note that a particular ack sequence has been received. 
 
static TypeId GetTypeId(void)
 
Base class for all RTT Estimators. 
 
Helper class to store RTT measurements. 
 
Time m_currentEstimatedRtt
 
void Measurement(Time measure)
Add a new measurement to the estimator.