26 #ifndef NFD_DAEMON_FW_ASF_MEASUREMENTS_HPP
27 #define NFD_DAEMON_FW_ASF_MEASUREMENTS_HPP
32 #include <ndn-cxx/util/rtt-estimator.hpp>
34 #include <unordered_map>
44 FaceInfo(shared_ptr<const ndn::util::RttEstimator::Options> opts)
45 : m_rttEstimator(std::move(opts))
52 return !!m_timeoutEvent;
65 m_rttEstimator.addMeasurement(rtt);
90 return m_rttEstimator.getSmoothedRtt();
102 m_nTimeouts = nTimeouts;
110 ndn::util::RttEstimator m_rttEstimator;
112 Name m_lastInterestName;
113 size_t m_nTimeouts = 0;
116 scheduler::ScopedEventId m_measurementExpiration;
120 scheduler::ScopedEventId m_timeoutEvent;
139 : m_rttEstimatorOpts(std::move(opts))
155 return m_isProbingDue;
167 return m_isFirstProbeScheduled;
173 m_isFirstProbeScheduled = isScheduled;
177 std::unordered_map<FaceId, FaceInfo> m_fiMap;
178 shared_ptr<const ndn::util::RttEstimator::Options> m_rttEstimatorOpts;
179 bool m_isProbingDue =
false;
180 bool m_isFirstProbeScheduled =
false;
215 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::microseconds MEASUREMENTS_LIFETIME
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
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)
time::nanoseconds scheduleTimeout(const Name &interestName, scheduler::EventCallback cb)
Stores strategy information about each face in this namespace.
NamespaceInfo(shared_ptr< const ndn::util::RttEstimator::Options > opts)
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)
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.