26 #ifndef NFD_DAEMON_FW_ASF_MEASUREMENTS_HPP
27 #define NFD_DAEMON_FW_ASF_MEASUREMENTS_HPP
33 #include <ndn-cxx/util/rtt-estimator.hpp>
35 #include <unordered_map>
46 FaceInfo(shared_ptr<const ndn::util::RttEstimator::Options> opts)
47 : m_rttEstimator(std::move(opts))
54 return !!m_timeoutEvent;
58 scheduleTimeout(
const Name& interestName, ndn::scheduler::EventCallback cb);
67 m_rttEstimator.addMeasurement(rtt);
86 return m_rttEstimator.getSmoothedRtt();
98 m_nTimeouts = nTimeouts;
106 ndn::util::RttEstimator m_rttEstimator;
108 Name m_lastInterestName;
109 size_t m_nTimeouts = 0;
112 ndn::scheduler::ScopedEventId m_measurementExpiration;
116 ndn::scheduler::ScopedEventId m_timeoutEvent;
135 NamespaceInfo(shared_ptr<const ndn::util::RttEstimator::Options> opts, time::milliseconds measurementLifetime)
136 : m_rttEstimatorOpts(std::move(opts))
137 , m_measurementLifetime(measurementLifetime)
153 return m_isProbingDue;
165 return m_isFirstProbeScheduled;
171 m_isFirstProbeScheduled = isScheduled;
175 std::unordered_map<FaceId, FaceInfo> m_fiMap;
176 shared_ptr<const ndn::util::RttEstimator::Options> m_rttEstimatorOpts;
177 time::milliseconds m_measurementLifetime;
178 bool m_isProbingDue =
false;
179 bool m_isFirstProbeScheduled =
false;
210 BOOST_ASSERT(measurementsLifetime > 0_ms);
211 m_measurementsLifetime = measurementsLifetime;
217 return m_measurementsLifetime;
230 shared_ptr<const ndn::util::RttEstimator::Options> m_rttEstimatorOpts;
Represents an entry in the FIB.
Contains arbitrary information placed by the forwarding strategy on table entries.
Helper class to retrieve and create strategy measurements.
NamespaceInfo & getOrCreateNamespaceInfo(const fib::Entry &fibEntry, const Name &prefix)
AsfMeasurements(MeasurementsAccessor &measurements)
static constexpr time::milliseconds DEFAULT_MEASUREMENTS_LIFETIME
void setMeasurementsLifetime(time::milliseconds measurementsLifetime)
time::milliseconds getMeasurementsLifetime() const
FaceInfo & getOrCreateFaceInfo(const fib::Entry &fibEntry, const Name &interestName, FaceId faceId)
FaceInfo * getFaceInfo(const fib::Entry &fibEntry, const Name &interestName, FaceId faceId)
NamespaceInfo * getNamespaceInfo(const Name &prefix)
Strategy information for each face in a namespace.
static constexpr time::nanoseconds RTT_TIMEOUT
void cancelTimeout(const Name &prefix)
bool isTimeoutScheduled() const
size_t getNTimeouts() const
time::nanoseconds scheduleTimeout(const Name &interestName, ndn::scheduler::EventCallback cb)
static constexpr time::nanoseconds RTT_NO_MEASUREMENT
time::nanoseconds getSrtt() const
void setNTimeouts(size_t nTimeouts)
time::nanoseconds getLastRtt() const
FaceInfo(shared_ptr< const ndn::util::RttEstimator::Options > opts)
void recordTimeout(const Name &interestName)
void recordRtt(time::nanoseconds rtt)
Stores strategy information about each face in this namespace.
void setIsFirstProbeScheduled(bool isScheduled)
bool isFirstProbeScheduled() const
FaceInfo * getFaceInfo(FaceId faceId)
static constexpr int getTypeId()
void extendFaceInfoLifetime(FaceInfo &info, FaceId faceId)
FaceInfo & getOrCreateFaceInfo(FaceId faceId)
NamespaceInfo(shared_ptr< const ndn::util::RttEstimator::Options > opts, time::milliseconds measurementLifetime)
void setIsProbingDue(bool isProbingDue)
bool isProbingDue() const
Represents an entry in the Measurements table.
Allows fw::Strategy to access the portion of Measurements table under its namespace.
uint64_t FaceId
Identifies a face.