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
PartialName getPrefix(ssize_t nComponents) const
Extract a prefix (PartialName) of the name, containing first nComponents components.
const Name & getPrefix() 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)
void setMeasurementExpirationEventId(const scheduler::EventId &id)
generalization of a network interface
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
void extendLifetime(Entry &entry, const time::nanoseconds &lifetime)
extend lifetime of an entry
Entry * findLongestPrefixMatch(const Name &name, const EntryPredicate &pred=AnyEntry()) const
perform a longest prefix match for name
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)
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
static constexpr time::microseconds MEASUREMENTS_LIFETIME
Name abstraction to represent an absolute name.
void setTimeoutEvent(const scheduler::EventId &id, const Name &interestName)
bool isPrefixOf(const Name &name) const
Check if the N components of this name are the same as the first N components of the given name...
std::pair< T *, bool > insertStrategyInfo(A &&... args)
insert a StrategyInfo item
Strategy information for each face in a namespace.
size_t size() const
Get the number of components.
void expireFaceInfo(nfd::face::FaceId faceId)
allows Strategy to access portion of Measurements table under its namespace
NamespaceInfo * getNamespaceInfo(const Name &prefix)
EventId schedule(const time::nanoseconds &after, const Scheduler::Event &event)
schedule an event
Entry * get(const Name &name)
find or insert a Measurements entry for name
void recordTimeout(const Name &interestName)
uint64_t FaceId
identifies a face
#define NFD_LOG_INIT(name)
bool isTimeoutScheduled() const
time::duration< double, boost::micro > Rtt
const Name & getName() const