From: Daniel R. Carvalho Date: Thu, 2 Apr 2020 20:35:53 +0000 (+0200) Subject: mem-cache: Add stats for failed compressions X-Git-Tag: v20.1.0.0~182 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bc92a06cf516740b1275393c8bc6c117102ddfc4;p=gem5.git mem-cache: Add stats for failed compressions 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 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33384 Reviewed-by: Nikos Nikoleris Maintainer: Nikos Nikoleris Tested-by: kokoro --- diff --git a/src/mem/cache/compressors/base.cc b/src/mem/cache/compressors/base.cc index 788a76f1e..5b96e97b6 100644 --- a/src/mem/cache/compressors/base.cc +++ b/src/mem/cache/compressors/base.cc @@ -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", diff --git a/src/mem/cache/compressors/base.hh b/src/mem/cache/compressors/base.hh index 1008aaee9..2725f7189 100644 --- a/src/mem/cache/compressors/base.hh +++ b/src/mem/cache/compressors/base.hh @@ -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;