Hoa Nguyen has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38916 )

Change subject: cpu,mem,sim: Use ADD_STAT macro where possible
......................................................................

cpu,mem,sim: Use ADD_STAT macro where possible

Change-Id: I3cf0a2a321742445cf7100115eacbc411c70f4fb
Signed-off-by: Hoa Nguyen <hoangu...@ucdavis.edu>
---
M src/cpu/base.cc
M src/mem/abstract_mem.cc
M src/mem/cache/base.cc
M src/mem/cache/compressors/base.cc
M src/mem/cache/compressors/base_dictionary_compressor.cc
M src/mem/cache/compressors/multi.cc
M src/mem/cache/tags/base.cc
M src/mem/cache/tags/sector_tags.cc
M src/mem/coherent_xbar.cc
M src/mem/ruby/slicc_interface/AbstractController.cc
M src/mem/xbar.cc
M src/sim/root.cc
M src/sim/workload.hh
13 files changed, 101 insertions(+), 150 deletions(-)



diff --git a/src/cpu/base.cc b/src/cpu/base.cc
index 0c998be..f933774 100644
--- a/src/cpu/base.cc
+++ b/src/cpu/base.cc
@@ -734,12 +734,10 @@

 BaseCPU::GlobalStats::GlobalStats(::Stats::Group *parent)
     : ::Stats::Group(parent),
-    simInsts(this, "sim_insts", "Number of instructions simulated"),
- simOps(this, "sim_ops", "Number of ops (including micro ops) simulated"),
-    hostInstRate(this, "host_inst_rate",
-                 "Simulator instruction rate (inst/s)"),
-    hostOpRate(this, "host_op_rate",
-               "Simulator op (including micro ops) rate (op/s)")
+    ADD_STAT(simInsts, "Number of instructions simulated"),
+    ADD_STAT(simOps, "Number of ops (including micro ops) simulated"),
+    ADD_STAT(hostInstRate, "Simulator instruction rate (inst/s)"),
+    ADD_STAT(hostOpRate, "Simulator op (including micro ops) rate (op/s)")
 {
     simInsts
         .functor(BaseCPU::numSimulatedInsts)
diff --git a/src/mem/abstract_mem.cc b/src/mem/abstract_mem.cc
index 7e09832..782a298 100644
--- a/src/mem/abstract_mem.cc
+++ b/src/mem/abstract_mem.cc
@@ -113,26 +113,19 @@

 AbstractMemory::MemStats::MemStats(AbstractMemory &_mem)
     : Stats::Group(&_mem), mem(_mem),
-    bytesRead(this, "bytes_read",
-              "Number of bytes read from this memory"),
-    bytesInstRead(this, "bytes_inst_read",
-                  "Number of instructions bytes read from this memory"),
-    bytesWritten(this, "bytes_written",
-                 "Number of bytes written to this memory"),
-    numReads(this, "num_reads",
-             "Number of read requests responded to by this memory"),
-    numWrites(this, "num_writes",
-              "Number of write requests responded to by this memory"),
-    numOther(this, "num_other",
-             "Number of other requests responded to by this memory"),
-    bwRead(this, "bw_read",
-           "Total read bandwidth from this memory (bytes/s)"),
-    bwInstRead(this, "bw_inst_read",
-               "Instruction read bandwidth from this memory (bytes/s)"),
-    bwWrite(this, "bw_write",
-            "Write bandwidth from this memory (bytes/s)"),
-    bwTotal(this, "bw_total",
-            "Total bandwidth to/from this memory (bytes/s)")
+    ADD_STAT(bytesRead, "Number of bytes read from this memory"),
+    ADD_STAT(bytesInstRead,
+             "Number of instructions bytes read from this memory"),
+    ADD_STAT(bytesWritten, "Number of bytes written to this memory"),
+ ADD_STAT(numReads, "Number of read requests responded to by this memory"),
+    ADD_STAT(numWrites,
+             "Number of write requests responded to by this memory"),
+ ADD_STAT(numOther, "Number of other requests responded to by this memory"),
+    ADD_STAT(bwRead, "Total read bandwidth from this memory (bytes/s)"),
+    ADD_STAT(bwInstRead,
+             "Instruction read bandwidth from this memory (bytes/s)"),
+    ADD_STAT(bwWrite, "Write bandwidth from this memory (bytes/s)"),
+    ADD_STAT(bwTotal, "Total bandwidth to/from this memory (bytes/s)")
 {
 }

diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc
index 3181a0c..efdb548 100644
--- a/src/mem/cache/base.cc
+++ b/src/mem/cache/base.cc
@@ -2106,67 +2106,44 @@
 BaseCache::CacheStats::CacheStats(BaseCache &c)
     : Stats::Group(&c), cache(c),

-    demandHits(this, "demand_hits", "number of demand (read+write) hits"),
-
-    overallHits(this, "overall_hits", "number of overall hits"),
-    demandMisses(this, "demand_misses",
-                 "number of demand (read+write) misses"),
-    overallMisses(this, "overall_misses", "number of overall misses"),
-    demandMissLatency(this, "demand_miss_latency",
-                      "number of demand (read+write) miss cycles"),
-    overallMissLatency(this, "overall_miss_latency",
-                       "number of overall miss cycles"),
-    demandAccesses(this, "demand_accesses",
-                   "number of demand (read+write) accesses"),
-    overallAccesses(this, "overall_accesses",
-                    "number of overall (read+write) accesses"),
-    demandMissRate(this, "demand_miss_rate",
-                   "miss rate for demand accesses"),
-    overallMissRate(this, "overall_miss_rate",
-                    "miss rate for overall accesses"),
-    demandAvgMissLatency(this, "demand_avg_miss_latency",
-                         "average overall miss latency"),
-    overallAvgMissLatency(this, "overall_avg_miss_latency",
-                          "average overall miss latency"),
-    blocked_cycles(this, "blocked_cycles",
-                   "number of cycles access was blocked"),
-    blocked_causes(this, "blocked", "number of cycles access was blocked"),
-    avg_blocked(this, "avg_blocked_cycles",
-                "average number of cycles each access was blocked"),
-    unusedPrefetches(this, "unused_prefetches",
-                     "number of HardPF blocks evicted w/o reference"),
-    writebacks(this, "writebacks", "number of writebacks"),
-    demandMshrHits(this, "demand_mshr_hits",
-                   "number of demand (read+write) MSHR hits"),
-    overallMshrHits(this, "overall_mshr_hits",
-                    "number of overall MSHR hits"),
-    demandMshrMisses(this, "demand_mshr_misses",
-                     "number of demand (read+write) MSHR misses"),
-    overallMshrMisses(this, "overall_mshr_misses",
-                      "number of overall MSHR misses"),
-    overallMshrUncacheable(this, "overall_mshr_uncacheable_misses",
-                           "number of overall MSHR uncacheable misses"),
-    demandMshrMissLatency(this, "demand_mshr_miss_latency",
- "number of demand (read+write) MSHR miss cycles"),
-    overallMshrMissLatency(this, "overall_mshr_miss_latency",
-                           "number of overall MSHR miss cycles"),
-    overallMshrUncacheableLatency(this, "overall_mshr_uncacheable_latency",
- "number of overall MSHR uncacheable cycles"),
-    demandMshrMissRate(this, "demand_mshr_miss_rate",
-                       "mshr miss rate for demand accesses"),
-    overallMshrMissRate(this, "overall_mshr_miss_rate",
-                        "mshr miss rate for overall accesses"),
-    demandAvgMshrMissLatency(this, "demand_avg_mshr_miss_latency",
-                             "average overall mshr miss latency"),
-    overallAvgMshrMissLatency(this, "overall_avg_mshr_miss_latency",
-                              "average overall mshr miss latency"),
-    overallAvgMshrUncacheableLatency(
-        this, "overall_avg_mshr_uncacheable_latency",
-        "average overall mshr uncacheable latency"),
-    replacements(this, "replacements", "number of replacements"),
-
-    dataExpansions(this, "data_expansions", "number of data expansions"),
- dataContractions(this, "data_contractions", "number of data contractions"),
+    ADD_STAT(demandHits, "number of demand (read+write) hits"),
+    ADD_STAT(overallHits, "number of overall hits"),
+    ADD_STAT(demandMisses, "number of demand (read+write) misses"),
+    ADD_STAT(overallMisses, "number of overall misses"),
+ ADD_STAT(demandMissLatency, "number of demand (read+write) miss cycles"),
+    ADD_STAT(overallMissLatency, "number of overall miss cycles"),
+    ADD_STAT(demandAccesses, "number of demand (read+write) accesses"),
+    ADD_STAT(overallAccesses, "number of overall (read+write) accesses"),
+    ADD_STAT(demandMissRate, "miss rate for demand accesses"),
+    ADD_STAT(overallMissRate, "miss rate for overall accesses"),
+    ADD_STAT(demandAvgMissLatency, "average overall miss latency"),
+    ADD_STAT(overallAvgMissLatency, "average overall miss latency"),
+    ADD_STAT(blocked_cycles, "number of cycles access was blocked"),
+    ADD_STAT(blocked_causes, "number of cycles access was blocked"),
+ ADD_STAT(avg_blocked,"average number of cycles each access was blocked"),
+    ADD_STAT(unusedPrefetches,
+             "number of HardPF blocks evicted w/o reference"),
+    ADD_STAT(writebacks, "number of writebacks"),
+    ADD_STAT(demandMshrHits, "number of demand (read+write) MSHR hits"),
+    ADD_STAT(overallMshrHits, "number of overall MSHR hits"),
+ ADD_STAT(demandMshrMisses, "number of demand (read+write) MSHR misses"),
+    ADD_STAT(overallMshrMisses, "number of overall MSHR misses"),
+    ADD_STAT(overallMshrUncacheable,
+             "number of overall MSHR uncacheable misses"),
+    ADD_STAT(demandMshrMissLatency,
+             "number of demand (read+write) MSHR miss cycles"),
+    ADD_STAT(overallMshrMissLatency, "number of overall MSHR miss cycles"),
+    ADD_STAT(overallMshrUncacheableLatency,
+             "number of overall MSHR uncacheable cycles"),
+    ADD_STAT(demandMshrMissRate, "mshr miss rate for demand accesses"),
+    ADD_STAT(overallMshrMissRate, "mshr miss rate for overall accesses"),
+ ADD_STAT(demandAvgMshrMissLatency, "average overall mshr miss latency"), + ADD_STAT(overallAvgMshrMissLatency, "average overall mshr miss latency"),
+    ADD_STAT(overallAvgMshrUncacheableLatency,
+             "average overall mshr uncacheable latency"),
+    ADD_STAT(replacements, "number of replacements"),
+    ADD_STAT(dataExpansions, "number of data expansions"),
+    ADD_STAT(dataContractions, "number of data contractions"),
     cmd(MemCmd::NUM_MEM_CMDS)
 {
     for (int idx = 0; idx < MemCmd::NUM_MEM_CMDS; ++idx)
diff --git a/src/mem/cache/compressors/base.cc b/src/mem/cache/compressors/base.cc
index 1febe7d..2f49e48 100644
--- a/src/mem/cache/compressors/base.cc
+++ b/src/mem/cache/compressors/base.cc
@@ -227,18 +227,13 @@

 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",
-        "Total compressed data size, in bits"),
-    avgCompressionSizeBits(this, "avg_compression_size_bits",
-        "Average compression size, in bits"),
-    decompressions(this, "total_decompressions",
-        "Total number of decompressions")
+    ADD_STAT(compressions, "Total number of compressions"),
+    ADD_STAT(failedCompressions, "Total number of failed compressions"),
+ ADD_STAT(compressionSize, "Number of blocks that were compressed to this "
+                              "power of two size"),
+    ADD_STAT(compressionSizeBits, "Total compressed data size, in bits"),
+    ADD_STAT(avgCompressionSizeBits, "Average compression size, in bits"),
+    ADD_STAT(decompressions, "Total number of decompressions")
 {
 }

diff --git a/src/mem/cache/compressors/base_dictionary_compressor.cc b/src/mem/cache/compressors/base_dictionary_compressor.cc
index 16a7d40..6e67dc1 100644
--- a/src/mem/cache/compressors/base_dictionary_compressor.cc
+++ b/src/mem/cache/compressors/base_dictionary_compressor.cc
@@ -45,8 +45,8 @@
 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")
+    ADD_STAT(patterns,
+             "Number of data entries that were compressed to this pattern")
 {
 }

diff --git a/src/mem/cache/compressors/multi.cc b/src/mem/cache/compressors/multi.cc
index 8fc8f35..c8f327f 100644
--- a/src/mem/cache/compressors/multi.cc
+++ b/src/mem/cache/compressors/multi.cc
@@ -188,8 +188,8 @@

 Multi::MultiStats::MultiStats(BaseStats& base_group, Multi& _compressor)
   : Stats::Group(&base_group), compressor(_compressor),
-    ranks(this, "ranks",
-        "Number of times each compressor had the nth best compression")
+    ADD_STAT(ranks,
+ "Number of times each compressor had the nth best compression")
 {
 }

diff --git a/src/mem/cache/tags/base.cc b/src/mem/cache/tags/base.cc
index edd85a4..b12fdf0 100644
--- a/src/mem/cache/tags/base.cc
+++ b/src/mem/cache/tags/base.cc
@@ -216,27 +216,18 @@
     : Stats::Group(&_tags),
     tags(_tags),

-    tagsInUse(this, "tagsinuse",
-              "Cycle average of tags in use"),
-    totalRefs(this, "total_refs",
-              "Total number of references to valid blocks."),
-    sampledRefs(this, "sampled_refs",
-                "Sample count of references to valid blocks."),
-    avgRefs(this, "avg_refs",
-            "Average number of references to valid blocks."),
-    warmupCycle(this, "warmup_cycle",
-                "Cycle when the warmup percentage was hit."),
-    occupancies(this, "occ_blocks",
-                "Average occupied blocks per requestor"),
-    avgOccs(this, "occ_percent",
-            "Average percentage of cache occupancy"),
-    occupanciesTaskId(this, "occ_task_id_blocks",
-                      "Occupied blocks per task id"),
-    ageTaskId(this, "age_task_id_blocks", "Occupied blocks per task id"),
-    percentOccsTaskId(this, "occ_task_id_percent",
-                      "Percentage of cache occupancy per task id"),
-    tagAccesses(this, "tag_accesses", "Number of tag accesses"),
-    dataAccesses(this, "data_accesses", "Number of data accesses")
+    ADD_STAT(tagsInUse, "Cycle average of tags in use"),
+    ADD_STAT(totalRefs, "Total number of references to valid blocks."),
+    ADD_STAT(sampledRefs, "Sample count of references to valid blocks."),
+    ADD_STAT(avgRefs, "Average number of references to valid blocks."),
+    ADD_STAT(warmupCycle, "Cycle when the warmup percentage was hit."),
+    ADD_STAT(occupancies, "Average occupied blocks per requestor"),
+    ADD_STAT(avgOccs, "Average percentage of cache occupancy"),
+    ADD_STAT(occupanciesTaskId, "Occupied blocks per task id"),
+    ADD_STAT(ageTaskId, "Occupied blocks per task id"),
+ ADD_STAT(percentOccsTaskId, "Percentage of cache occupancy per task id"),
+    ADD_STAT(tagAccesses, "Number of tag accesses"),
+    ADD_STAT(dataAccesses, "Number of data accesses")
 {
 }

diff --git a/src/mem/cache/tags/sector_tags.cc b/src/mem/cache/tags/sector_tags.cc
index ff2f4a4..3a141e5 100644
--- a/src/mem/cache/tags/sector_tags.cc
+++ b/src/mem/cache/tags/sector_tags.cc
@@ -338,8 +338,8 @@
 SectorTags::SectorTagsStats::SectorTagsStats(BaseTagStats &base_group,
     SectorTags& _tags)
   : Stats::Group(&base_group), tags(_tags),
-    evictionsReplacement(this, "evictions_replacement",
-        "Number of blocks evicted due to a replacement")
+    ADD_STAT(evictionsReplacement,
+             "Number of blocks evicted due to a replacement")
 {
 }

diff --git a/src/mem/coherent_xbar.cc b/src/mem/coherent_xbar.cc
index 002d1b5..b780682 100644
--- a/src/mem/coherent_xbar.cc
+++ b/src/mem/coherent_xbar.cc
@@ -59,9 +59,9 @@
       pointOfCoherency(p.point_of_coherency),
       pointOfUnification(p.point_of_unification),

-      snoops(this, "snoops", "Total snoops (count)"),
-      snoopTraffic(this, "snoopTraffic", "Total snoop traffic (bytes)"),
-      snoopFanout(this, "snoop_fanout", "Request fanout histogram")
+      ADD_STAT(snoops, "Total snoops (count)"),
+      ADD_STAT(snoopTraffic, "Total snoop traffic (bytes)"),
+      ADD_STAT(snoopFanout, "Request fanout histogram")
 {
     // create the ports based on the size of the memory-side port and
     // CPU-side port vector ports, and the presence of the default port,
diff --git a/src/mem/ruby/slicc_interface/AbstractController.cc b/src/mem/ruby/slicc_interface/AbstractController.cc
index 4241d72..5d006da 100644
--- a/src/mem/ruby/slicc_interface/AbstractController.cc
+++ b/src/mem/ruby/slicc_interface/AbstractController.cc
@@ -423,10 +423,9 @@
 AbstractController::
 ControllerStats::ControllerStats(Stats::Group *parent)
     : Stats::Group(parent),
-      m_fully_busy_cycles(this, "fully_busy_cycles",
-                          "cycles for which number of transistions == max "
-                          "transitions"),
-      m_delayHistogram(this, "delay_histogram")
+      ADD_STAT(m_fully_busy_cycles,
+ "cycles for which number of transistions == max transitions"),
+      ADD_STAT(m_delayHistogram, "delay_histogram")
 {
     m_fully_busy_cycles
         .flags(Stats::nozero);
diff --git a/src/mem/xbar.cc b/src/mem/xbar.cc
index 49ee8ac..b75904c 100644
--- a/src/mem/xbar.cc
+++ b/src/mem/xbar.cc
@@ -63,11 +63,11 @@
       gotAllAddrRanges(false), defaultPortID(InvalidPortID),
       useDefaultRange(p.use_default_range),

-      transDist(this, "trans_dist", "Transaction distribution"),
-      pktCount(this, "pkt_count",
- "Packet count per connected requestor and responder (bytes)"),
-      pktSize(this, "pkt_size", "Cumulative packet size per connected "
-             "requestor and responder (bytes)")
+      ADD_STAT(transDist, "Transaction distribution"),
+      ADD_STAT(pktCount,
+ "Packet count per connected requestor and responder (bytes)"), + ADD_STAT(pktSize, "Cumulative packet size per connected requestor and "
+                        "responder (bytes)")
 {
 }

diff --git a/src/sim/root.cc b/src/sim/root.cc
index 7ca84bf..4927940 100644
--- a/src/sim/root.cc
+++ b/src/sim/root.cc
@@ -54,15 +54,14 @@

 Root::RootStats::RootStats()
     : Stats::Group(nullptr),
-    simSeconds(this, "sim_seconds", "Number of seconds simulated"),
-    simTicks(this, "sim_ticks", "Number of ticks simulated"),
-    finalTick(this, "final_tick",
-              "Number of ticks from beginning of simulation "
-              "(restored from checkpoints and never reset)"),
-    simFreq(this, "sim_freq", "Frequency of simulated ticks"),
-    hostSeconds(this, "host_seconds", "Real time elapsed on the host"),
-    hostTickRate(this, "host_tick_rate", "Simulator tick rate (ticks/s)"),
- hostMemory(this, "host_mem_usage", "Number of bytes of host memory used"),
+    ADD_STAT(simSeconds, "Number of seconds simulated"),
+    ADD_STAT(simTicks, "Number of ticks simulated"),
+    ADD_STAT(finalTick, "Number of ticks from beginning of simulation "
+                        "(restored from checkpoints and never reset)"),
+    ADD_STAT(simFreq, "Frequency of simulated ticks"),
+    ADD_STAT(hostSeconds, "Real time elapsed on the host"),
+    ADD_STAT(hostTickRate, "Simulator tick rate (ticks/s)"),
+    ADD_STAT(hostMemory, "Number of bytes of host memory used"),

     statTime(true),
     startTick(0)
diff --git a/src/sim/workload.hh b/src/sim/workload.hh
index c789b65..647225b 100644
--- a/src/sim/workload.hh
+++ b/src/sim/workload.hh
@@ -48,9 +48,8 @@
         Stats::Scalar quiesce;

         WorkloadStats(Workload *workload) : Stats::Group(workload),
-            arm(this, "inst.arm", "number of arm instructions executed"),
-            quiesce(this, "inst.quiesce",
-                    "number of quiesce instructions executed")
+            ADD_STAT(arm, "number of arm instructions executed"),
+            ADD_STAT(quiesce, "number of quiesce instructions executed")
         {}
     } stats;


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38916
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: I3cf0a2a321742445cf7100115eacbc411c70f4fb
Gerrit-Change-Number: 38916
Gerrit-PatchSet: 1
Gerrit-Owner: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-MessageType: newchange
_______________________________________________
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

Reply via email to