36 const double RttStats::ALPHA = 0.125;
39 : m_srtt(RTT_NO_MEASUREMENT)
40 , m_rtt(RTT_NO_MEASUREMENT)
51 m_srtt = computeSrtt(m_srtt, m_rtt);
55 RttStats::computeSrtt(
Rtt previousSrtt,
Rtt currentRtt)
61 return Rtt(ALPHA * currentRtt + (1 - ALPHA) * previousSrtt);
68 : m_isTimeoutScheduled(false)
81 if (!m_isTimeoutScheduled) {
82 m_timeoutEventId = id;
83 m_isTimeoutScheduled =
true;
84 m_lastInterestName = interestName;
87 BOOST_THROW_EXCEPTION(
FaceInfo::Error(
"Tried to schedule a timeout for a face that already has a timeout scheduled."));
92 FaceInfo::cancelTimeoutEvent()
95 m_isTimeoutScheduled =
false;
99 FaceInfo::cancelTimeoutEvent(
const Name& prefix)
107 FaceInfo::doesNameMatchLastInterest(
const Name& name)
109 return m_lastInterestName.isPrefixOf(name);
116 pit::OutRecordCollection::const_iterator outRecord = pitEntry->getOutRecord(inFace);
118 if (outRecord == pitEntry->out_end()) {
119 NFD_LOG_TRACE(pitEntry->getInterest() <<
" dataFrom inFace=" << inFace.getId() <<
" no-out-record");
123 time::steady_clock::Duration steadyRtt = time::steady_clock::now() - outRecord->getLastRenewed();
129 <<
" RTT: " << m_rttStats.
getRtt()
130 <<
" SRTT: " << m_rttStats.
getSrtt());
144 : m_isProbingDue(false)
145 , m_hasFirstProbeBeenScheduled(false)
154 if (it != m_fit.end()) {
169 if (it == m_fit.end()) {
170 const auto& pair = m_fit.insert(std::make_pair(face.getId(),
FaceInfo()));
171 info = &pair.first->second;
207 : m_measurements(measurements)
237 BOOST_ASSERT(info !=
nullptr);
248 for (
size_t prefixLen = fibEntry.
getPrefix().size() + 1;
249 me ==
nullptr && prefixLen <= interest.
getName().size(); ++prefixLen) {
250 me = m_measurements.get(interest.getName().getPrefix(prefixLen));
254 BOOST_ASSERT(me !=
nullptr);
260 BOOST_ASSERT(info !=
nullptr);
const Name & getName() const
FaceInfo & getOrCreateFaceInfo(const fib::Entry &fibEntry, const Interest &interest, const Face &face)
represents a Measurements entry
void cancel(const EventId &eventId)
cancel a scheduled event
time::microseconds Duration
NamespaceInfo * getNamespaceInfo(const Name &prefix)
FaceInfo * getFaceInfo(const fib::Entry &fibEntry, const Face &face)
void extendFaceInfoLifetime(FaceInfo &info, const Face &face)
void addRttMeasurement(RttEstimator::Duration &durationRtt)
time::duration< double, boost::micro > Rtt
std::pair< T *, bool > insertStrategyInfo(A &&...args)
insert a StrategyInfo item
Table::const_iterator iterator
void cancelTimeoutEvent(const Name &prefix)
FaceInfo * getFaceInfo(const fib::Entry &fibEntry, const Interest &interest, const Face &face)
const Name & getPrefix() const
static constexpr time::microseconds MEASUREMENTS_LIFETIME
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
NamespaceInfo & getOrCreateNamespaceInfo(const fib::Entry &fibEntry, const Interest &interest)
const scheduler::EventId & getMeasurementExpirationEventId()
bool isTimeoutScheduled() const
void recordRtt(const shared_ptr< pit::Entry > &pitEntry, const Face &inFace)
void expireFaceInfo(nfd::face::FaceId faceId)
stores stategy information about each face in this namespace
void recordTimeout(const Name &interestName)
void setTimeoutEvent(const scheduler::EventId &id, const Name &interestName)
#define NFD_LOG_INIT(name)
static const Rtt RTT_TIMEOUT
EventId schedule(time::nanoseconds after, const EventCallback &event)
schedule an event
#define NFD_LOG_TRACE(expression)
uint64_t FaceId
identifies a face
AsfMeasurements(MeasurementsAccessor &measurements)
FaceInfo & getOrCreateFaceInfo(const fib::Entry &fibEntry, const Face &face)
void setMeasurementExpirationEventId(const scheduler::EventId &id)
void addMeasurement(Duration measure)
Strategy information for each face in a namespace.
static const Rtt RTT_NO_MEASUREMENT