mem-cache: Add MSHR debuging information
Add debug statment in MSHR and MSHRQueue class to track the number of free MSHR each time a new one is allocated/deallocated. Also track the allocation/deallocation of each MSHR target. Change-Id: I2533e7660da1cde3052425f8db8852e59d463b42 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/47041 Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Maintainer: Daniel Carvalho <odanrc@yahoo.com.br> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
12
src/mem/cache/mshr.cc
vendored
12
src/mem/cache/mshr.cc
vendored
@@ -178,6 +178,8 @@ MSHR::TargetList::add(PacketPtr pkt, Tick readyTime,
|
||||
}
|
||||
|
||||
emplace_back(pkt, readyTime, order, source, markPending, alloc_on_fill);
|
||||
|
||||
DPRINTF(MSHR, "New target allocated: %s\n", pkt->print());
|
||||
}
|
||||
|
||||
|
||||
@@ -411,6 +413,8 @@ MSHR::allocateTarget(PacketPtr pkt, Tick whenReady, Counter _order,
|
||||
targets.add(pkt, whenReady, _order, Target::FromCPU, !inService,
|
||||
alloc_on_fill);
|
||||
}
|
||||
|
||||
DPRINTF(MSHR, "After target allocation: %s", print());
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -719,12 +723,12 @@ MSHR::print(std::ostream &os, int verbosity, const std::string &prefix) const
|
||||
hasFromCache() ? "HasFromCache" : "");
|
||||
|
||||
if (!targets.empty()) {
|
||||
ccprintf(os, "%s Targets:\n", prefix);
|
||||
targets.print(os, verbosity, prefix + " ");
|
||||
ccprintf(os, "%s Targets:\n", prefix);
|
||||
targets.print(os, verbosity, prefix + " ");
|
||||
}
|
||||
if (!deferredTargets.empty()) {
|
||||
ccprintf(os, "%s Deferred Targets:\n", prefix);
|
||||
deferredTargets.print(os, verbosity, prefix + " ");
|
||||
ccprintf(os, "%s Deferred Targets:\n", prefix);
|
||||
deferredTargets.print(os, verbosity, prefix + " ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
4
src/mem/cache/mshr.hh
vendored
4
src/mem/cache/mshr.hh
vendored
@@ -53,7 +53,9 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/printable.hh"
|
||||
#include "base/trace.hh"
|
||||
#include "base/types.hh"
|
||||
#include "debug/MSHR.hh"
|
||||
#include "mem/cache/queue_entry.hh"
|
||||
#include "mem/packet.hh"
|
||||
#include "mem/request.hh"
|
||||
@@ -460,6 +462,8 @@ class MSHR : public QueueEntry, public Printable
|
||||
*/
|
||||
void popTarget()
|
||||
{
|
||||
DPRINTF(MSHR, "Force deallocating MSHR targets: %s\n",
|
||||
targets.front().pkt->print());
|
||||
targets.pop_front();
|
||||
}
|
||||
|
||||
|
||||
15
src/mem/cache/mshr_queue.cc
vendored
15
src/mem/cache/mshr_queue.cc
vendored
@@ -46,6 +46,7 @@
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "debug/MSHR.hh"
|
||||
#include "mem/cache/mshr.hh"
|
||||
|
||||
MSHRQueue::MSHRQueue(const std::string &_label,
|
||||
@@ -64,6 +65,9 @@ MSHRQueue::allocate(Addr blk_addr, unsigned blk_size, PacketPtr pkt,
|
||||
assert(mshr->getNumTargets() == 0);
|
||||
freeList.pop_front();
|
||||
|
||||
DPRINTF(MSHR, "Allocating new MSHR. Number in use will be %lu/%lu\n",
|
||||
allocatedList.size() + 1, numEntries);
|
||||
|
||||
mshr->allocate(blk_addr, blk_size, pkt, when_ready, order, alloc_on_fill);
|
||||
mshr->allocIter = allocatedList.insert(allocatedList.end(), mshr);
|
||||
mshr->readyIter = addToReadyList(mshr);
|
||||
@@ -72,6 +76,17 @@ MSHRQueue::allocate(Addr blk_addr, unsigned blk_size, PacketPtr pkt,
|
||||
return mshr;
|
||||
}
|
||||
|
||||
void
|
||||
MSHRQueue::deallocate(MSHR* mshr)
|
||||
{
|
||||
|
||||
DPRINTF(MSHR, "Deallocating all targets: %s", mshr->print());
|
||||
Queue<MSHR>::deallocate(mshr);
|
||||
DPRINTF(MSHR, "MSHR deallocated. Number in use: %lu/%lu\n",
|
||||
allocatedList.size(), numEntries);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MSHRQueue::moveToFront(MSHR *mshr)
|
||||
{
|
||||
|
||||
5
src/mem/cache/mshr_queue.hh
vendored
5
src/mem/cache/mshr_queue.hh
vendored
@@ -96,6 +96,11 @@ class MSHRQueue : public Queue<MSHR>
|
||||
MSHR *allocate(Addr blk_addr, unsigned blk_size, PacketPtr pkt,
|
||||
Tick when_ready, Counter order, bool alloc_on_fill);
|
||||
|
||||
/**
|
||||
* Deallocate a MSHR and its targets
|
||||
*/
|
||||
void deallocate(MSHR *mshr) override;
|
||||
|
||||
/**
|
||||
* Moves the MSHR to the front of the pending list if it is not
|
||||
* in service.
|
||||
|
||||
3
src/mem/cache/queue.hh
vendored
3
src/mem/cache/queue.hh
vendored
@@ -234,7 +234,8 @@ class Queue : public Drainable, public Named
|
||||
*
|
||||
* @param entry
|
||||
*/
|
||||
void deallocate(Entry *entry)
|
||||
virtual void
|
||||
deallocate(Entry *entry)
|
||||
{
|
||||
allocatedList.erase(entry->allocIter);
|
||||
freeList.push_front(entry);
|
||||
|
||||
Reference in New Issue
Block a user