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)
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");
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);
249 me ==
nullptr && prefixLen <= interest.
getName().
size(); ++prefixLen) {
254 BOOST_ASSERT(me !=
nullptr);
260 BOOST_ASSERT(info !=
nullptr);
time::microseconds Duration
const Name & getName() const
FaceInfo & getOrCreateFaceInfo(const fib::Entry &fibEntry, const Face &face)
FaceInfo & getOrCreateFaceInfo(const fib::Entry &fibEntry, const Interest &interest, const Face &face)
void recordRtt(const shared_ptr< pit::Entry > &pitEntry, const Face &inFace)
bool isTimeoutScheduled() const
void setMeasurementExpirationEventId(const scheduler::EventId &id)
void extendFaceInfoLifetime(FaceInfo &info, const Face &face)
void cancel(const EventId &eventId)
cancel a scheduled event
void addRttMeasurement(RttEstimator::Duration &durationRtt)
static time_point now() noexcept
const scheduler::EventId & getMeasurementExpirationEventId()
AsfMeasurements(MeasurementsAccessor &measurements)
represents an Interest packet
stores stategy information about each face in this namespace
static const Rtt RTT_TIMEOUT
void cancelTimeoutEvent(const Name &prefix)
represents a Measurements entry
Table::const_iterator iterator
std::shared_ptr< ns3::EventId > EventId
FaceInfo * getFaceInfo(const fib::Entry &fibEntry, const Face &face)
#define NFD_LOG_TRACE(expression)
void addMeasurement(Duration measure)
FaceInfo * getFaceInfo(const fib::Entry &fibEntry, const Interest &interest, const Face &face)
std::pair< T *, bool > insertStrategyInfo(A &&...args)
insert a StrategyInfo item
Copyright (c) 2011-2015 Regents of the University of California.
NamespaceInfo & getOrCreateNamespaceInfo(const fib::Entry &fibEntry, const Interest &interest)
static const Rtt RTT_NO_MEASUREMENT
size_t size() const
Get number of components.
static constexpr time::microseconds MEASUREMENTS_LIFETIME
Represents an absolute name.
bool isPrefixOf(const Name &other) const
Check if this name is a prefix of another name.
void setTimeoutEvent(const scheduler::EventId &id, const Name &interestName)
Strategy information for each face in a namespace.
void expireFaceInfo(nfd::face::FaceId faceId)
NamespaceInfo * getNamespaceInfo(const Name &prefix)
EventId schedule(time::nanoseconds after, const EventCallback &event)
schedule an event
void recordTimeout(const Name &interestName)
PartialName getPrefix(ssize_t nComponents) const
Extract a prefix of the name.
uint64_t FaceId
identifies a face
#define NFD_LOG_INIT(name)
const Name & getPrefix() const
time::duration< double, boost::micro > Rtt