43#include "params/QoSPropFairPolicy.hh"
58 "weight must be a value between 0 and 1");
64template <
typename Requestor>
73 history.push_back(std::make_pair(
id, score));
76 "Policy's maximum number of requestors is currently dictated "
77 "by the maximum number of priorities\n");
94 const double old_score,
const uint64_t served_bytes)
const
96 return ((1.0 -
weight) * old_score) + (
weight * served_bytes);
104 {
return lhs.second > rhs.second; };
111 const double served_bytes =
static_cast<double>(pkt_size);
113 uint8_t pkt_priority = 0;
114 for (
auto m_hist =
history.begin(); m_hist !=
history.end(); m_hist++) {
117 double& curr_score = m_hist->second;
119 if (curr_id == pkt_id) {
121 pkt_priority = std::distance(
history.begin(), m_hist);
123 curr_score =
updateScore(curr_score, served_bytes);
@ invldRequestorId
Invalid requestor id for assertion checking only.
Abstract superclass for simulation objects.
RequestorID lookupRequestorId(const SimObject *obj) const
Looks up the RequestorID for a given SimObject returns an invalid RequestorID (invldRequestorId) if n...
uint8_t numPriorities() const
Gets the total number of priority levels in the QoS memory controller.
System * system() const
read the system pointer
MemCtrl * memCtrl
Pointer to parent memory controller implementing the policy.
void initRequestorObj(const SimObject *requestor, const double score)
Initialize the requestor's score by providing the requestor's SimObject pointer and initial score val...
void initRequestorName(const std::string requestor, const double score)
Initialize the requestor's score by providing the requestor's name and initial score value.
PropFairPolicy(const Params &)
virtual uint8_t schedule(const RequestorID id, const uint64_t pkt_size) override
Schedules a packet based on proportional fair configuration.
std::vector< RequestorHistory > history
QoSPropFairPolicyParams Params
void initRequestor(const Requestor requestor, const double score)
const double weight
PF Policy weight.
virtual ~PropFairPolicy()
double updateScore(const double old_score, const uint64_t served_bytes) const
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.