36 "ProbingModule::DEFAULT_PROBING_INTERVAL must be less than AsfMeasurements::MEASUREMENTS_LIFETIME");
39 : m_probingInterval(DEFAULT_PROBING_INTERVAL)
40 , m_measurements(measurements)
53 if (info ==
nullptr) {
70 FaceInfoFacePairSet rankedFaces(
71 [] (FaceInfoFacePair pairLhs, FaceInfoFacePair pairRhs) ->
bool {
84 Face& hopFace = hop.getFace();
100 rankedFaces.insert(std::make_pair(info, &hopFace));
103 if (rankedFaces.empty()) {
108 return getFaceBasedOnProbability(rankedFaces);
120 uint64_t interval = getRandomNumber(0, 5000);
141 ProbingModule::getFaceBasedOnProbability(
const FaceInfoFacePairSet& rankedFaces)
143 double randomNumber = getRandomNumber(0, 1);
144 uint64_t rankSum = ((rankedFaces.size() + 1) * rankedFaces.size()) / 2;
149 for (
const FaceInfoFacePair pair : rankedFaces) {
150 double probability = getProbingProbability(rank++, rankSum, rankedFaces.size());
161 if (randomNumber <= offset + probability) {
166 offset += probability;
175 ProbingModule::getProbingProbability(uint64_t rank, uint64_t rankSum, uint64_t nFaces)
180 return static_cast<double>(nFaces + 1 - rank) / rankSum;
184 ProbingModule::getRandomNumber(
double start,
double end)
186 std::uniform_real_distribution<double> dist(start, end);
bool isProbingDue() const
const Name & getPrefix() const
Helper class to retrieve and create strategy measurements.
generalization of a network interface
bool hasSrttMeasurement() const
ProbingModule(AsfMeasurements &measurements)
represents an Interest packet
stores stategy information about each face in this namespace
bool isProbingNeeded(const fib::Entry &fibEntry, const Interest &interest)
FaceInfo * getFaceInfo(const fib::Entry &fibEntry, const Interest &interest, const Face &face)
Copyright (c) 2011-2015 Regents of the University of California.
void setHasFirstProbeBeenScheduled(bool hasBeenScheduled)
void setIsProbingDue(bool isProbingDue)
NamespaceInfo & getOrCreateNamespaceInfo(const fib::Entry &fibEntry, const Interest &interest)
static constexpr time::microseconds MEASUREMENTS_LIFETIME
void scheduleProbe(const fib::Entry &fibEntry, const time::milliseconds &interval)
Name abstraction to represent an absolute name.
bool isFirstProbeScheduled() const
Face * getFaceToProbe(const Face &inFace, const Interest &interest, const fib::Entry &fibEntry, const Face &faceUsed)
Strategy information for each face in a namespace.
std::mt19937 & getGlobalRng()
NamespaceInfo * getNamespaceInfo(const Name &prefix)
EventId schedule(const time::nanoseconds &after, const Scheduler::Event &event)
schedule an event
RttStats::Rtt getSrtt() const
void afterForwardingProbe(const fib::Entry &fibEntry, const Interest &interest)
const NextHopList & getNextHops() const
static constexpr time::seconds DEFAULT_PROBING_INTERVAL
represents a nexthop record in FIB entry