mem-cache: Override print function of sector and super blocks
Pass management of printing sector and super block's contents to them. Change-Id: Ided8d404450a0fa39127ac7d2d6578d95691f509 Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/36582 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Daniel Carvalho
parent
c8f3ff5e18
commit
97a766100b
8
src/mem/cache/tags/compressed_tags.cc
vendored
8
src/mem/cache/tags/compressed_tags.cc
vendored
@@ -150,12 +150,8 @@ CompressedTags::findVictim(Addr addr, const bool is_secure,
|
||||
assert(!victim->isValid());
|
||||
|
||||
// Print all co-allocated blocks
|
||||
DPRINTF(CacheComp, "Co-Allocation: offset %d with blocks\n", offset);
|
||||
for (const auto& blk : victim_superblock->blks){
|
||||
if (blk->isValid()) {
|
||||
DPRINTFR(CacheComp, "\t[%s]\n", blk->print());
|
||||
}
|
||||
}
|
||||
DPRINTF(CacheComp, "Co-Allocation: offset %d of %s\n", offset,
|
||||
victim_superblock->print());
|
||||
}
|
||||
|
||||
// Update number of sub-blocks evicted due to a replacement
|
||||
|
||||
13
src/mem/cache/tags/sector_blk.cc
vendored
13
src/mem/cache/tags/sector_blk.cc
vendored
@@ -150,3 +150,16 @@ SectorBlk::setPosition(const uint32_t set, const uint32_t way)
|
||||
blk->setPosition(set, way);
|
||||
}
|
||||
}
|
||||
|
||||
std::string
|
||||
SectorBlk::print() const
|
||||
{
|
||||
std::string sub_blk_print;
|
||||
for (const auto& sub_blk : blks) {
|
||||
if (sub_blk->isValid()) {
|
||||
sub_blk_print += "\t[" + sub_blk->print() + "]\n";
|
||||
}
|
||||
}
|
||||
return csprintf("%s valid sub-blks (%d):\n%s",
|
||||
TaggedEntry::print(), getNumValid(), sub_blk_print);
|
||||
}
|
||||
|
||||
7
src/mem/cache/tags/sector_blk.hh
vendored
7
src/mem/cache/tags/sector_blk.hh
vendored
@@ -177,6 +177,13 @@ class SectorBlk : public TaggedEntry
|
||||
* @param way The way of this entry and sub-entries.
|
||||
*/
|
||||
void setPosition(const uint32_t set, const uint32_t way) override;
|
||||
|
||||
/**
|
||||
* Print relevant information for this sector block and its sub-blocks.
|
||||
*
|
||||
* @return A string with the contents of the sector block.
|
||||
*/
|
||||
std::string print() const override;
|
||||
};
|
||||
|
||||
#endif //__MEM_CACHE_TAGS_SECTOR_BLK_HH__
|
||||
|
||||
6
src/mem/cache/tags/super_blk.cc
vendored
6
src/mem/cache/tags/super_blk.cc
vendored
@@ -236,3 +236,9 @@ SuperBlk::setCompressionFactor(const uint8_t compression_factor)
|
||||
compressionFactor = compression_factor;
|
||||
}
|
||||
}
|
||||
|
||||
std::string
|
||||
SuperBlk::print() const
|
||||
{
|
||||
return csprintf("CF: %d %s", getCompressionFactor(), SectorBlk::print());
|
||||
}
|
||||
|
||||
2
src/mem/cache/tags/super_blk.hh
vendored
2
src/mem/cache/tags/super_blk.hh
vendored
@@ -236,6 +236,8 @@ class SuperBlk : public SectorBlk
|
||||
void setCompressionFactor(const uint8_t compression_factor);
|
||||
|
||||
void invalidate() override;
|
||||
|
||||
std::string print() const override;
|
||||
};
|
||||
|
||||
#endif //__MEM_CACHE_TAGS_SUPER_BLK_HH__
|
||||
|
||||
Reference in New Issue
Block a user