NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
rtt-estimator.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (C) 2016-2018, Arizona Board of Regents.
4
*
5
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6
*
7
* ndn-cxx library is free software: you can redistribute it and/or modify it under the
8
* terms of the GNU Lesser General Public License as published by the Free Software
9
* Foundation, either version 3 of the License, or (at your option) any later version.
10
*
11
* ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14
*
15
* You should have received copies of the GNU General Public License and GNU Lesser
16
* General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17
* <http://www.gnu.org/licenses/>.
18
*
19
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20
*
21
* @author Shuo Yang
22
* @author Weiwei Liu
23
* @author Chavoosh Ghasemi
24
*/
25
26
#ifndef NDN_CXX_UTIL_RTT_ESTIMATOR_HPP
27
#define NDN_CXX_UTIL_RTT_ESTIMATOR_HPP
28
29
#include "
ndn-cxx/util/signal.hpp
"
30
#include "
ndn-cxx/util/time.hpp
"
31
32
namespace
ndn
{
33
namespace
util {
34
41
class
RttEstimator
42
{
43
public
:
44
using
MillisecondsDouble
= time::duration<double, time::milliseconds::period>;
45
46
public
:
47
class
Options
48
{
49
public
:
50
constexpr
51
Options
() noexcept
52
{
53
}
54
55
public
:
56
double
alpha
= 0.125;
57
double
beta
= 0.25;
58
int
k
= 4;
59
MillisecondsDouble
initialRto
=
MillisecondsDouble
(1000.0);
60
MillisecondsDouble
minRto
=
MillisecondsDouble
(200.0);
61
MillisecondsDouble
maxRto
=
MillisecondsDouble
(20000.0);
62
int
rtoBackoffMultiplier
= 2;
63
};
64
71
explicit
72
RttEstimator
(
const
Options
& options =
Options
());
73
83
void
84
addMeasurement
(
MillisecondsDouble
rtt,
size_t
nExpectedSamples);
85
89
MillisecondsDouble
90
getEstimatedRto
()
const
91
{
92
return
m_rto;
93
}
94
98
MillisecondsDouble
99
getMinRtt
()
const
100
{
101
return
m_rttMin;
102
}
103
107
MillisecondsDouble
108
getMaxRtt
()
const
109
{
110
return
m_rttMax;
111
}
112
116
MillisecondsDouble
117
getAvgRtt
()
const
118
{
119
return
m_rttAvg;
120
}
121
125
void
126
backoffRto
();
127
128
private
:
129
const
Options m_options;
130
MillisecondsDouble
m_sRtt;
131
MillisecondsDouble
m_rttVar;
132
MillisecondsDouble
m_rto;
133
MillisecondsDouble
m_rttMin;
134
MillisecondsDouble
m_rttMax;
135
MillisecondsDouble
m_rttAvg;
136
int64_t m_nRttSamples;
137
};
138
139
}
// namespace util
140
}
// namespace ndn
141
142
#endif // NDN_CXX_UTIL_RTT_ESTIMATOR_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::util::RttEstimator::getAvgRtt
MillisecondsDouble getAvgRtt() const
Returns the average RTT.
Definition:
rtt-estimator.hpp:117
ndn::util::RttEstimator::Options::minRto
MillisecondsDouble minRto
lower bound of RTO
Definition:
rtt-estimator.hpp:60
ndn::util::RttEstimator::getMaxRtt
MillisecondsDouble getMaxRtt() const
Returns the maximum RTT observed.
Definition:
rtt-estimator.hpp:108
ndn::util::RttEstimator
RTT Estimator.
Definition:
rtt-estimator.hpp:41
ndn::util::RttEstimator::Options::alpha
double alpha
weight of exponential moving average for meanRtt
Definition:
rtt-estimator.hpp:56
ndn::util::RttEstimator::Options
Definition:
rtt-estimator.hpp:47
ndn::util::RttEstimator::Options::Options
constexpr Options() noexcept
Definition:
rtt-estimator.hpp:51
ndn::util::RttEstimator::Options::beta
double beta
weight of exponential moving average for varRtt
Definition:
rtt-estimator.hpp:57
ndn::util::RttEstimator::backoffRto
void backoffRto()
Backoff RTO by a factor of Options::rtoBackoffMultiplier.
Definition:
rtt-estimator.cpp:73
ndn::util::RttEstimator::RttEstimator
RttEstimator(const Options &options=Options())
Create a RTT Estimator.
Definition:
rtt-estimator.cpp:34
ndn::util::RttEstimator::Options::initialRto
MillisecondsDouble initialRto
initial RTO value
Definition:
rtt-estimator.hpp:59
time.hpp
ndn::util::RttEstimator::addMeasurement
void addMeasurement(MillisecondsDouble rtt, size_t nExpectedSamples)
Add a new RTT measurement to the estimator.
Definition:
rtt-estimator.cpp:47
ndn::util::RttEstimator::Options::rtoBackoffMultiplier
int rtoBackoffMultiplier
Definition:
rtt-estimator.hpp:62
ndn::util::RttEstimator::Options::maxRto
MillisecondsDouble maxRto
upper bound of RTO
Definition:
rtt-estimator.hpp:61
ndn::util::RttEstimator::getMinRtt
MillisecondsDouble getMinRtt() const
Returns the minimum RTT observed.
Definition:
rtt-estimator.hpp:99
signal.hpp
ndn::util::RttEstimator::Options::k
int k
factor of RTT variation when calculating RTO
Definition:
rtt-estimator.hpp:58
ndn::util::RttEstimator::getEstimatedRto
MillisecondsDouble getEstimatedRto() const
Returns the estimated RTO value.
Definition:
rtt-estimator.hpp:90
ndn::util::RttEstimator::MillisecondsDouble
time::duration< double, time::milliseconds::period > MillisecondsDouble
Definition:
rtt-estimator.hpp:44
ndnSIM
ndn-cxx
ndn-cxx
util
rtt-estimator.hpp
Generated on Sun Feb 24 2019 22:16:07 for ndnSIM by
1.8.15