Daniel Carvalho has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/33376 )
Change subject: mem-cache: Upgrade BaseDictionaryCompressor's stats
......................................................................
mem-cache: Upgrade BaseDictionaryCompressor's stats
Upgrade this compressor's stats to match current stats API.
Change-Id: I1cb69230f8deca053bc860cedafc9e6e78446df7
Signed-off-by: Daniel R. Carvalho <oda...@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33376
Reviewed-by: Nikos Nikoleris <nikos.nikole...@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikole...@arm.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/mem/cache/compressors/base_dictionary_compressor.cc
M src/mem/cache/compressors/dictionary_compressor.hh
M src/mem/cache/compressors/dictionary_compressor_impl.hh
3 files changed, 30 insertions(+), 25 deletions(-)
Approvals:
Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/mem/cache/compressors/base_dictionary_compressor.cc
b/src/mem/cache/compressors/base_dictionary_compressor.cc
index d6af8ee..ebbfc1c 100644
--- a/src/mem/cache/compressors/base_dictionary_compressor.cc
+++ b/src/mem/cache/compressors/base_dictionary_compressor.cc
@@ -37,26 +37,31 @@
namespace Compressor {
BaseDictionaryCompressor::BaseDictionaryCompressor(const Params *p)
- : Base(p), dictionarySize(p->dictionary_size), numEntries(0)
+ : Base(p), dictionarySize(p->dictionary_size),
+ numEntries(0), dictionaryStats(stats, *this)
+{
+}
+
+BaseDictionaryCompressor::DictionaryStats::DictionaryStats(
+ BaseStats& base_group, BaseDictionaryCompressor& _compressor)
+ : Stats::Group(&base_group), compressor(_compressor),
+ patterns(this, "pattern",
+ "Number of data entries that were compressed to this pattern")
{
}
void
-BaseDictionaryCompressor::regStats()
+BaseDictionaryCompressor::DictionaryStats::regStats()
{
- Base::regStats();
+ Stats::Group::regStats();
// We store the frequency of each pattern
- patternStats
- .init(getNumPatterns())
- .name(name() + ".pattern")
- .desc("Number of data entries that were compressed to this
pattern.")
- ;
-
- for (unsigned i = 0; i < getNumPatterns(); ++i) {
- patternStats.subname(i, getName(i));
- patternStats.subdesc(i, "Number of data entries that match
pattern " +
- getName(i));
+ patterns.init(compressor.getNumPatterns());
+ for (unsigned i = 0; i < compressor.getNumPatterns(); ++i) {
+ const std::string name = compressor.getName(i);
+ patterns.subname(i, name);
+ patterns.subdesc(i, "Number of data entries that match pattern " +
+ name);
}
}
diff --git a/src/mem/cache/compressors/dictionary_compressor.hh
b/src/mem/cache/compressors/dictionary_compressor.hh
index b9c68a1..b5e9e67 100644
--- a/src/mem/cache/compressors/dictionary_compressor.hh
+++ b/src/mem/cache/compressors/dictionary_compressor.hh
@@ -51,6 +51,7 @@
#include <type_traits>
#include <vector>
+#include "base/statistics.hh"
#include "base/types.hh"
#include "mem/cache/compressors/base.hh"
@@ -67,17 +68,18 @@
/** Number of valid entries in the dictionary. */
std::size_t numEntries;
- /**
- * @defgroup CompressionStats Compression specific statistics.
- * @{
- */
+ struct DictionaryStats : public Stats::Group
+ {
+ const BaseDictionaryCompressor& compressor;
- /** Number of data entries that were compressed to each pattern. */
- Stats::Vector patternStats;
+ DictionaryStats(BaseStats &base_group,
+ BaseDictionaryCompressor& _compressor);
- /**
- * @}
- */
+ void regStats() override;
+
+ /** Number of data entries that were compressed to each pattern. */
+ Stats::Vector patterns;
+ } dictionaryStats;
/**
* Trick function to get the number of patterns.
@@ -98,8 +100,6 @@
typedef BaseDictionaryCompressorParams Params;
BaseDictionaryCompressor(const Params *p);
~BaseDictionaryCompressor() = default;
-
- void regStats() override;
};
/**
diff --git a/src/mem/cache/compressors/dictionary_compressor_impl.hh
b/src/mem/cache/compressors/dictionary_compressor_impl.hh
index 0b486e3..6b6e5fb 100644
--- a/src/mem/cache/compressors/dictionary_compressor_impl.hh
+++ b/src/mem/cache/compressors/dictionary_compressor_impl.hh
@@ -104,7 +104,7 @@
}
// Update stats
- patternStats[pattern->getPatternNumber()]++;
+ dictionaryStats.patterns[pattern->getPatternNumber()]++;
// Push into dictionary
if (pattern->shouldAllocate()) {
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/33376
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: I1cb69230f8deca053bc860cedafc9e6e78446df7
Gerrit-Change-Number: 33376
Gerrit-PatchSet: 2
Gerrit-Owner: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s