mem-cache: Add stats for failed compressions
authorDaniel R. Carvalho <odanrc@yahoo.com.br>
Thu, 2 Apr 2020 20:35:53 +0000 (22:35 +0200)
committerDaniel Carvalho <odanrc@yahoo.com.br>
Mon, 31 Aug 2020 17:45:43 +0000 (17:45 +0000)
Add statistics to keep track of the number of times compression
has failed to provide blocks whose compressed size passes the
size threshold.

Also, update the compressed data's size if compression fails.

Change-Id: If3479572bf114f07911238c602ffef3a90b6a931
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33384
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/mem/cache/compressors/base.cc
src/mem/cache/compressors/base.hh

index 788a76f1e1f2991a75f2c8c85c93cf440a6c0100..5b96e97b6fe6caa9561c04639228da167b5b60a3 100644 (file)
@@ -148,6 +148,7 @@ Base::compress(const uint64_t* data, Cycles& comp_lat, Cycles& decomp_lat)
     if (comp_size_bits > sizeThreshold * CHAR_BIT) {
         comp_size_bits = blkSize * CHAR_BIT;
         comp_data->setSizeBits(comp_size_bits);
+        stats.failedCompressions++;
     }
 
     // Update stats
@@ -209,6 +210,8 @@ Base::BaseStats::BaseStats(Base& _compressor)
   : Stats::Group(&_compressor), compressor(_compressor),
     compressions(this, "compressions",
         "Total number of compressions"),
+    failedCompressions(this, "failed_compressions",
+        "Total number of failed compressions"),
     compressionSize(this, "compression_size",
         "Number of blocks that were compressed to this power of two size"),
     compressionSizeBits(this, "compression_size_bits",
index 1008aaee9c44a395dfedc0b290bd040b2c476b70..2725f7189cfbbad2f31647c9e134bbe4d2da56d6 100644 (file)
@@ -106,6 +106,9 @@ class Base : public SimObject
         /** Number of compressions performed. */
         Stats::Scalar compressions;
 
+        /** Number of failed compressions. */
+        Stats::Scalar failedCompressions;
+
         /** Number of blocks that were compressed to this power of two size. */
         Stats::Vector compressionSize;