ndn::util::RttEstimator Class Reference

RTT/RTO estimator. More...

#include <ndn-cxx/util/rtt-estimator.hpp>

+ Inheritance diagram for ndn::util::RttEstimator:
+ Collaboration diagram for ndn::util::RttEstimator:

Classes

struct  Options
 

Public Member Functions

 RttEstimator (shared_ptr< const Options > options=nullptr)
 Constructor. More...
 
void addMeasurement (time::nanoseconds rtt, size_t nExpectedSamples=1)
 Records a new RTT measurement. More...
 
void backoffRto ()
 Backoff RTO by a factor of Options::rtoBackoffMultiplier. More...
 
time::nanoseconds getEstimatedRto () const
 Returns the estimated RTO value. More...
 
time::nanoseconds getRttVariation () const
 Returns the RTT variation (RTTVAR). More...
 
time::nanoseconds getSmoothedRtt () const
 Returns the smoothed RTT value (SRTT). More...
 
bool hasSamples () const
 

Protected Attributes

shared_ptr< const Optionsm_options
 

Detailed Description

RTT/RTO estimator.

This class implements the "Mean-Deviation" RTT estimator, as discussed in RFC 6298, with the modifications to RTO calculation described in RFC 7323 Appendix G.

Definition at line 41 of file rtt-estimator.hpp.

Constructor & Destructor Documentation

◆ RttEstimator()

ndn::util::RttEstimator::RttEstimator ( shared_ptr< const Options options = nullptr)
explicit

Constructor.

Parameters
optionsoptions for the estimator; if nullptr, a default set of options is used

Definition at line 32 of file rtt-estimator.cpp.

Member Function Documentation

◆ addMeasurement()

void ndn::util::RttEstimator::addMeasurement ( time::nanoseconds  rtt,
size_t  nExpectedSamples = 1 
)

Records a new RTT measurement.

Parameters
rttthe sampled RTT
nExpectedSamplesnumber of expected samples, must be greater than 0. It should be set to the current number of in-flight Interests. Please refer to Appendix G of RFC 7323 for details.
Note
Do not call this function with RTT samples from retransmitted Interests (per Karn's algorithm).

Definition at line 46 of file rtt-estimator.cpp.

◆ backoffRto()

void ndn::util::RttEstimator::backoffRto ( )

Backoff RTO by a factor of Options::rtoBackoffMultiplier.

Definition at line 67 of file rtt-estimator.cpp.

◆ getEstimatedRto()

time::nanoseconds ndn::util::RttEstimator::getEstimatedRto ( ) const
inline

Returns the estimated RTO value.

Definition at line 83 of file rtt-estimator.hpp.

◆ getRttVariation()

time::nanoseconds ndn::util::RttEstimator::getRttVariation ( ) const
inline

Returns the RTT variation (RTTVAR).

Precondition
hasSamples() == true

Definition at line 103 of file rtt-estimator.hpp.

◆ getSmoothedRtt()

time::nanoseconds ndn::util::RttEstimator::getSmoothedRtt ( ) const
inline

Returns the smoothed RTT value (SRTT).

Precondition
hasSamples() == true

Definition at line 93 of file rtt-estimator.hpp.

◆ hasSamples()

bool ndn::util::RttEstimator::hasSamples ( ) const
inline

Definition at line 74 of file rtt-estimator.hpp.

Member Data Documentation

◆ m_options

shared_ptr<const Options> ndn::util::RttEstimator::m_options
protected

Definition at line 115 of file rtt-estimator.hpp.