base: Add print when inserting/evicting an AssociativeCache entry
We are adding two debug prints in the AssociativeCache: 1) Inserting print 2) Evicting print Among those, the evicting one is probably the most important This is because while the DPRINTF can be added in the Entry::insert implementation (called during insertion), the AssociativeCache does not reference any evict method. Instead, the findVictim is transparently invalidating the victim, which makes it impossible for the client code to understand whether the victim was a valid entry or not. Change-Id: I4fee59cc63c6b0e14c5b02bcf3ba5f58aa21ef9f Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
This commit is contained in:
12
src/base/cache/associative_cache.hh
vendored
12
src/base/cache/associative_cache.hh
vendored
@@ -232,6 +232,12 @@ class AssociativeCache : public Named
|
||||
|
||||
auto victim = static_cast<Entry*>(replPolicy->getVictim(candidates));
|
||||
|
||||
if (debugFlag && debugFlag->tracing() && victim->isValid()) {
|
||||
::gem5::trace::getDebugLogger()->dprintf_flag(
|
||||
curTick(), name(), debugFlag->name(),
|
||||
"Replacing entry: %s\n", victim->print());
|
||||
}
|
||||
|
||||
invalidate(victim);
|
||||
|
||||
return victim;
|
||||
@@ -257,6 +263,12 @@ class AssociativeCache : public Named
|
||||
virtual void
|
||||
insertEntry(const KeyType &key, Entry *entry)
|
||||
{
|
||||
if (debugFlag && debugFlag->tracing()) {
|
||||
::gem5::trace::getDebugLogger()->dprintf_flag(
|
||||
curTick(), name(), debugFlag->name(),
|
||||
"Inserting entry: %s\n", entry->print());
|
||||
}
|
||||
|
||||
entry->insert(key);
|
||||
replPolicy->reset(entry->replacementData);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user