mem-cache: Don't generate debug output unless you're going to use it.

The BaseCache::handleFill function would generate an "old_state" string
unconditionally, just in case it would need to print it out later on in
the function if the Cache debug variable was set. This is very wasteful.
We should only generate that string if we are actually going to use it
later on.

Change-Id: I4a570d1cd2814e5a089eac1233dedd1801d68975
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52405
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2021-11-03 22:04:53 -07:00
parent d6e402ad1e
commit 6d60e76a60

View File

@@ -1439,7 +1439,7 @@ BaseCache::handleFill(PacketPtr pkt, CacheBlk *blk, PacketList &writebacks,
Addr addr = pkt->getAddr();
bool is_secure = pkt->isSecure();
const bool has_old_data = blk && blk->isValid();
const std::string old_state = blk ? blk->print() : "";
const std::string old_state = (debug::Cache && blk) ? blk->print() : "";
// When handling a fill, we should have no writes to this line.
assert(addr == pkt->getBlockAddr(blkSize));