Daniel Carvalho has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/36582 )
Change subject: mem-cache: Override print function of sector and super
blocks
......................................................................
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 <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/36582
Reviewed-by: Nikos Nikoleris <[email protected]>
Maintainer: Nikos Nikoleris <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/mem/cache/tags/compressed_tags.cc
M src/mem/cache/tags/sector_blk.cc
M src/mem/cache/tags/sector_blk.hh
M src/mem/cache/tags/super_blk.cc
M src/mem/cache/tags/super_blk.hh
5 files changed, 30 insertions(+), 6 deletions(-)
Approvals:
Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/mem/cache/tags/compressed_tags.cc
b/src/mem/cache/tags/compressed_tags.cc
index f71deda..33d822a 100644
--- a/src/mem/cache/tags/compressed_tags.cc
+++ b/src/mem/cache/tags/compressed_tags.cc
@@ -150,12 +150,8 @@
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
diff --git a/src/mem/cache/tags/sector_blk.cc
b/src/mem/cache/tags/sector_blk.cc
index f738e02..c1c5f6a 100644
--- a/src/mem/cache/tags/sector_blk.cc
+++ b/src/mem/cache/tags/sector_blk.cc
@@ -150,3 +150,16 @@
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);
+}
diff --git a/src/mem/cache/tags/sector_blk.hh
b/src/mem/cache/tags/sector_blk.hh
index 049f49b..ba32450 100644
--- a/src/mem/cache/tags/sector_blk.hh
+++ b/src/mem/cache/tags/sector_blk.hh
@@ -177,6 +177,13 @@
* @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__
diff --git a/src/mem/cache/tags/super_blk.cc
b/src/mem/cache/tags/super_blk.cc
index d81cbc3..9a1de45 100644
--- a/src/mem/cache/tags/super_blk.cc
+++ b/src/mem/cache/tags/super_blk.cc
@@ -236,3 +236,9 @@
compressionFactor = compression_factor;
}
}
+
+std::string
+SuperBlk::print() const
+{
+ return csprintf("CF: %d %s", getCompressionFactor(),
SectorBlk::print());
+}
diff --git a/src/mem/cache/tags/super_blk.hh
b/src/mem/cache/tags/super_blk.hh
index d98c14e..64d73bd 100644
--- a/src/mem/cache/tags/super_blk.hh
+++ b/src/mem/cache/tags/super_blk.hh
@@ -236,6 +236,8 @@
void setCompressionFactor(const uint8_t compression_factor);
void invalidate() override;
+
+ std::string print() const override;
};
#endif //__MEM_CACHE_TAGS_SUPER_BLK_HH__
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/36582
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ided8d404450a0fa39127ac7d2d6578d95691f509
Gerrit-Change-Number: 36582
Gerrit-PatchSet: 4
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s