NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
+
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
p
q
r
s
t
u
v
w
+
Typedefs
a
b
c
d
e
f
h
i
k
l
n
o
p
q
r
s
t
u
v
+
Enumerations
a
b
c
d
f
i
k
l
n
p
q
r
s
t
u
+
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
+
Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
~
+
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
~
+
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Typedefs
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
+
Enumerations
_
a
c
e
i
r
s
t
v
+
Enumerator
a
c
d
e
f
i
k
l
m
n
p
r
s
u
v
w
+
Related Functions
b
c
d
e
f
g
i
k
l
m
n
o
p
s
v
+
Files
File List
+
File Members
+
All
a
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
+
Functions
c
f
h
m
r
s
u
w
+
Variables
a
c
d
f
g
i
k
l
m
n
p
r
s
t
Typedefs
+
Macros
a
d
e
f
i
l
m
n
o
p
r
s
u
v
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
rtt-estimator.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#include "
rtt-estimator.hpp
"
27
28
namespace
nfd
{
29
30
RttEstimator::RttEstimator
(uint16_t maxMultiplier,
Duration
minRto,
double
gain)
31
: m_maxMultiplier(maxMultiplier)
32
, m_minRto(minRto.count())
33
, m_rtt(
RttEstimator
::getInitialRtt().count())
34
, m_gain(gain)
35
, m_variance(0)
36
, m_multiplier(1)
37
, m_nSamples(0)
38
{
39
}
40
41
void
42
RttEstimator::addMeasurement
(
Duration
measure)
43
{
44
double
m = static_cast<double>(measure.count());
45
if
(m_nSamples > 0) {
46
double
err = m - m_rtt;
47
double
gErr = err * m_gain;
48
m_rtt += gErr;
49
double
difference =
std::abs
(err) - m_variance;
50
m_variance += difference * m_gain;
51
}
52
else
{
53
m_rtt = m;
54
m_variance = m;
55
}
56
++m_nSamples;
57
m_multiplier = 1;
58
}
59
60
void
61
RttEstimator::incrementMultiplier
()
62
{
63
m_multiplier = std::min(static_cast<uint16_t>(m_multiplier + 1), m_maxMultiplier);
64
}
65
66
void
67
RttEstimator::doubleMultiplier
()
68
{
69
m_multiplier = std::min(static_cast<uint16_t>(m_multiplier * 2), m_maxMultiplier);
70
}
71
72
RttEstimator::Duration
73
RttEstimator::computeRto
()
const
74
{
75
double
rto = std::max(m_minRto, m_rtt + 4 * m_variance);
76
rto *= m_multiplier;
77
return
Duration
(static_cast<Duration::rep>(rto));
78
}
79
80
}
// namespace nfd
nfd::RttEstimator::computeRto
Duration computeRto() const
Definition:
rtt-estimator.cpp:73
nfd::RttEstimator::RttEstimator
RttEstimator(uint16_t maxMultiplier=16, Duration minRto=1_ms, double gain=0.1)
Definition:
rtt-estimator.cpp:30
nfd::RttEstimator::Duration
time::microseconds Duration
Definition:
rtt-estimator.hpp:46
nfd::RttEstimator::doubleMultiplier
void doubleMultiplier()
Definition:
rtt-estimator.cpp:67
nfd::RttEstimator::incrementMultiplier
void incrementMultiplier()
Definition:
rtt-estimator.cpp:61
rtt-estimator.hpp
ndn::time::abs
constexpr duration< Rep, Period > abs(duration< Rep, Period > d)
Definition:
time.hpp:50
nfd::RttEstimator::addMeasurement
void addMeasurement(Duration measure)
Definition:
rtt-estimator.cpp:42
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::RttEstimator
implements the Mean-Deviation RTT estimator
Definition:
rtt-estimator.hpp:43
ndnSIM
NFD
core
rtt-estimator.cpp
Generated on Sun Feb 24 2019 22:16:07 for ndnSIM by
1.8.15