37 "ProbingModule::DEFAULT_PROBING_INTERVAL must be less than AsfMeasurements::MEASUREMENTS_LIFETIME");
40 : m_probingInterval(DEFAULT_PROBING_INTERVAL)
41 , m_measurements(measurements)
54 if (info ==
nullptr) {
67 const Interest& interest,
71 FaceInfoFacePairSet rankedFaces(
72 [] (FaceInfoFacePair pairLhs, FaceInfoFacePair pairRhs) ->
bool {
85 Face& hopFace = hop.getFace();
89 if (hopFace.getId() == inFace.getId() || hopFace.getId() == faceUsed.getId() ||
102 rankedFaces.insert(std::make_pair(info, &hopFace));
105 if (rankedFaces.empty()) {
110 return getFaceBasedOnProbability(rankedFaces);
122 uint64_t interval = getRandomNumber(0, 5000);
143 ProbingModule::getFaceBasedOnProbability(
const FaceInfoFacePairSet& rankedFaces)
145 double randomNumber = getRandomNumber(0, 1);
146 uint64_t rankSum = ((rankedFaces.size() + 1) * rankedFaces.size()) / 2;
151 for (
const FaceInfoFacePair pair : rankedFaces) {
152 double probability = getProbingProbability(rank++, rankSum, rankedFaces.size());
163 if (randomNumber <= offset + probability) {
168 offset += probability;
177 ProbingModule::getProbingProbability(uint64_t rank, uint64_t rankSum, uint64_t nFaces)
182 return static_cast<double>(nFaces + 1 - rank) / rankSum;
186 ProbingModule::getRandomNumber(
double start,
double end)
188 std::uniform_real_distribution<double> dist(start, end);
void scheduleProbe(const fib::Entry &fibEntry, const time::milliseconds &interval)
void afterForwardingProbe(const fib::Entry &fibEntry, const Interest &interest)
bool hasSrttMeasurement() const
ProbingModule(AsfMeasurements &measurements)
NamespaceInfo * getNamespaceInfo(const Name &prefix)
RttStats::Rtt getSrtt() const
void setIsProbingDue(bool isProbingDue)
FaceInfo * getFaceInfo(const fib::Entry &fibEntry, const Interest &interest, const Face &face)
const Name & getPrefix() const
static constexpr time::microseconds MEASUREMENTS_LIFETIME
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
static constexpr time::seconds DEFAULT_PROBING_INTERVAL
NamespaceInfo & getOrCreateNamespaceInfo(const fib::Entry &fibEntry, const Interest &interest)
void setHasFirstProbeBeenScheduled(bool hasBeenScheduled)
bool isProbingNeeded(const fib::Entry &fibEntry, const Interest &interest)
std::mt19937 & getGlobalRng()
stores stategy information about each face in this namespace
This file contains common algorithms used by forwarding strategies.
Declares the global pseudorandom number generator (PRNG) for NFD.
EventId schedule(time::nanoseconds after, const EventCallback &event)
schedule an event
bool isFirstProbeScheduled() const
Face * getFaceToProbe(const Face &inFace, const Interest &interest, const fib::Entry &fibEntry, const Face &faceUsed)
represents a nexthop record in FIB entry
bool wouldViolateScope(const Face &inFace, const Interest &interest, const Face &outFace)
determine whether forwarding the Interest in pitEntry to outFace would violate scope ...
const NextHopList & getNextHops() const
Strategy information for each face in a namespace.
Helper class to retrieve and create strategy measurements.
bool isProbingDue() const