99 "qos::MemCtrl::logRequest REQUESTOR %s [id %d] address %#x"
100 " prio %d this requestor q packets %d"
101 " - queue size %d - requested entries %d\n",
109 }
else if (dir ==
WRITE) {
115 for (
auto j = 0; j < entries; ++j) {
120 stats.avgPriority[
id].sample(_qos);
129 stats.avgPriorityDistance[
id].sample(distance);
131 "qos::MemCtrl::logRequest REQUESTOR %s [id %d]"
132 " registering priority distance %d for priority %d"
140 "qos::MemCtrl::logRequest REQUESTOR %s [id %d] prio %d "
141 "this requestor q packets %d - new queue size %d\n",
149 Addr addr, uint64_t entries,
double delay)
152 "Logging response with invalid requestor\n");
155 "qos::MemCtrl::logResponse REQUESTOR %s [id %d] address %#x prio"
156 " %d this requestor q packets %d"
157 " - queue size %d - requested entries %d\n",
165 }
else if (dir ==
WRITE) {
171 "qos::MemCtrl::logResponse requestor %s negative packets "
176 for (
auto j = 0; j < entries; ++j) {
179 "qos::MemCtrl::logResponse requestor %s unmatched response "
183 uint64_t requestTime = it->second.front();
186 it->second.pop_front();
189 if (it->second.empty()) {
193 double latency = (double) (
curTick() + delay - requestTime)
198 if (
stats.priorityMaxLatency[_qos].value() < latency) {
199 stats.priorityMaxLatency[_qos] = latency;
202 if (
stats.priorityMinLatency[_qos].value() > latency
203 ||
stats.priorityMinLatency[_qos].value() == 0) {
204 stats.priorityMinLatency[_qos] = latency;
210 "qos::MemCtrl::logResponse REQUESTOR %s [id %d] prio %d "
211 "this requestor q packets %d - new queue size %d\n",
223 "qos::MemCtrl::schedule requestor id [%d] "
224 "data received [%d], but QoS scheduler not initialized\n",
238 DPRINTF(QOS,
"qos::MemCtrl::schedule Packet received [Qv %d], "
239 "but QoS scheduler not initialized\n",
252 "qos::MemCtrl::selectNextBusState running policy %s\n",
258 "qos::MemCtrl::selectNextBusState running "
259 "default bus direction selection policy\n");
281 "qos::MemCtrl::addRequestor registering"
282 " Requestor %s [id %d]\n",
292 "Average QoS priority value for accepted requests"),
294 "Average QoS priority distance between assigned and queued "
298 "per QoS priority minimum request to response latency"),
300 "per QoS priority maximum request to response latency"),
302 "Number of turnarounds from READ to WRITE"),
304 "Number of turnarounds from WRITE to READ"),
306 "Number of times bus staying in READ state"),
308 "Number of times bus staying in WRITE state")
320 const auto max_requestors =
system->maxRequestors();
321 const auto num_priorities =
memCtrl.numPriorities();
325 .init(max_requestors)
331 .init(max_requestors)
336 .init(num_priorities)
341 .init(num_priorities)
345 for (
int i = 0;
i < max_requestors;
i++) {
346 const std::string
name =
system->getRequestorName(
i);
351 for (
int j = 0; j < num_priorities; ++j) {
362 stats.numWriteReadTurnArounds++;
364 stats.numReadWriteTurnArounds++;
368 stats.numStayReadState++;
370 stats.numStayWriteState++;
ClockedObject(const ClockedObjectParams &p)
virtual std::string name() const
uint8_t qosValue() const
QoS Value getter Returns 0 if QoS value was never set (constructor default).
RequestPtr req
A pointer to the original request.
BusState getBusState() const
Gets the current bus state.
void logResponse(BusState dir, RequestorID id, uint8_t _qos, Addr addr, uint64_t entries, double delay)
Called upon receiving a response, updates statistics and updates queues status.
std::vector< uint64_t > writeQueueSizes
Write request packets queue length in #packets, per QoS priority.
uint64_t totalWriteQueueSize
Total write request packets queue length in #packets.
const bool qosPriorityEscalation
Enables QoS priority escalation.
void recordTurnaroundStats(BusState busState, BusState busStateNext)
Record statistics on turnarounds based on busStateNext and busState values.
std::vector< Tick > serviceTick
Vector of QoS priorities/last service time.
std::unordered_map< RequestorID, std::vector< uint64_t > > packetPriorities
Hash of requestors - number of packets queued per priority.
std::vector< uint64_t > readQueueSizes
Read request packets queue length in #packets, per QoS priority.
const std::unique_ptr< Policy > policy
QoS Policy, assigns QoS priority to the incoming packets.
const std::unique_ptr< QueuePolicy > queuePolicy
QoS Queue Policy: selects packet among same-priority queue.
MemCtrl(const QoSMemCtrlParams &)
QoS Memory base class.
BusState selectNextBusState()
Returns next bus direction (READ or WRITE) based on configured policy.
const std::unique_ptr< TurnaroundPolicy > turnPolicy
QoS Bus Turnaround Policy: selects the bus direction (READ/WRITE)
const bool qosSyncroScheduler
Enables QoS synchronized scheduling invokes the QoS scheduler on all requestors, at every packet arri...
bool hasRequestor(RequestorID id) const
hasRequestor returns true if the selected requestor(ID) has been registered in the memory controller,...
uint8_t numPriorities() const
Gets the total number of priority levels in the QoS memory controller.
uint64_t getTotalWriteQueueSize() const
Gets the total combined WRITE queues size.
const uint8_t _numPriorities
Number of configured QoS priorities.
void addRequestor(const RequestorID id)
Initializes dynamically counters and statistics for a given Requestor.
BusState busState
Bus state used to control the read/write switching and drive the scheduling of the next request.
System * _system
Pointer to the System object.
uint64_t totalReadQueueSize
Total read request packets queue length in #packets.
std::unordered_map< RequestorID, std::unordered_map< uint64_t, std::deque< uint64_t > > > requestTimes
Hash of requestors - address of request - queue of times of request.
gem5::memory::qos::MemCtrl::MemCtrlStats stats
System * system() const
read the system pointer
BusState busStateNext
bus state for next request event triggered
uint8_t schedule(RequestorID id, uint64_t data)
uint64_t getTotalReadQueueSize() const
Gets the total combined READ queues size.
std::unordered_map< RequestorID, const std::string > requestors
Hash of requestor ID - requestor name.
void logRequest(BusState dir, RequestorID id, uint8_t _qos, Addr addr, uint64_t entries)
Called upon receiving a request or updates statistics and updates queues status.
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
virtual void regStats()
Callback to set stat parameters.
double s
These variables equal the number of ticks in the unit of time they're named after in a double.
const FlagsType nonan
Don't print if this is NAN.
const FlagsType nozero
Don't print if this is zero.
Copyright (c) 2024 Arm Limited All rights reserved.
Tick curTick()
The universal simulation clock.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
statistics::VectorStandardDeviation avgPriorityDistance
per-requestor average QoS distance between assigned and queued values
statistics::VectorStandardDeviation avgPriority
per-requestor average QoS priority
statistics::Vector priorityMaxLatency
per-priority maximum latency
statistics::Vector priorityMinLatency
per-priority minimum latency
statistics::Scalar numStayReadState
Count the number of times bus staying in READ state.
MemCtrlStats(MemCtrl &mc)
statistics::Scalar numReadWriteTurnArounds
Count the number of turnarounds READ to WRITE.
void regStats() override
Callback to set stat parameters.
statistics::Scalar numStayWriteState
Count the number of times bus staying in WRITE state.
statistics::Scalar numWriteReadTurnArounds
Count the number of turnarounds WRITE to READ.