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;
136 : m_rttEstimatorOpts(std::move(opts))
152 return m_isProbingDue;
164 return m_isFirstProbeScheduled;
170 m_isFirstProbeScheduled = isScheduled;
174 std::unordered_map<FaceId, FaceInfo> m_fiMap;
175 shared_ptr<const ndn::util::RttEstimator::Options> m_rttEstimatorOpts;
176 bool m_isProbingDue =
false;
177 bool m_isFirstProbeScheduled =
false;
213 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
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.
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.