[gem5-dev] Change in gem5/gem5[develop]: mem-cache, stats: Stats update for snoop filter

2020-11-23 Thread Maryam Babaie (Gerrit) via gem5-dev
Maryam Babaie has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/36355 )


Change subject: mem-cache, stats: Stats update for snoop filter
..

mem-cache, stats: Stats update for snoop filter

Change-Id: I339bbc4268d5b9501421a2a6a76e5267422c87aa
Signed-off-by: Maryam Babaie 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/36355
Reviewed-by: Bobby R. Bruce 
Maintainer: Bobby R. Bruce 
Tested-by: kokoro 
---
M src/mem/snoop_filter.cc
M src/mem/snoop_filter.hh
2 files changed, 36 insertions(+), 41 deletions(-)

Approvals:
  Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/mem/snoop_filter.cc b/src/mem/snoop_filter.cc
index 7ced30c..d799707 100644
--- a/src/mem/snoop_filter.cc
+++ b/src/mem/snoop_filter.cc
@@ -97,12 +97,12 @@
 // updateRequest.
 reqLookupResult.retryItem = sf_item;

-totRequests++;
+stats.totRequests++;
 if (is_hit) {
 if (interested.count() == 1)
-hitSingleRequests++;
+stats.hitSingleRequests++;
 else
-hitMultiRequests++;
+stats.hitMultiRequests++;
 }

 DPRINTF(SnoopFilter, "%s:   SF value %x.%x\n",
@@ -207,12 +207,12 @@

 SnoopMask interested = (sf_item.holder | sf_item.requested);

-totSnoops++;
+stats.totSnoops++;

 if (interested.count() == 1)
-hitSingleSnoops++;
+stats.hitSingleSnoops++;
 else
-hitMultiSnoops++;
+stats.hitMultiSnoops++;

 // ReadEx and Writes require both invalidation and exlusivity, while  
reads
 // require neither. Writebacks on the other hand require exclusivity  
but

@@ -387,36 +387,26 @@
 __func__, sf_item.requested, sf_item.holder);
 }

+SnoopFilter::SnoopFilterStats::SnoopFilterStats(Stats::Group *parent):
+Stats::Group(parent),
+ADD_STAT(totRequests,"Total number of requests made to the snoop filter."),
+ADD_STAT(hitSingleRequests,
+  "Number of requests hitting in the snoop filter with a  
single "\

+  "holder of the requested data."),
+ADD_STAT(hitMultiRequests,
+  "Number of requests hitting in the snoop filter with  
multiple "\

+  "(>1) holders of the requested data."),
+ADD_STAT(totSnoops,"Total number of snoops made to the snoop filter."),
+ADD_STAT(hitSingleSnoops,
+  "Number of snoops hitting in the snoop filter with a  
single "\

+  "holder of the requested data."),
+ADD_STAT(hitMultiSnoops,
+  "Number of snoops hitting in the snoop filter with  
multiple "\

+  "(>1) holders of the requested data.")
+{}
+
 void
 SnoopFilter::regStats()
 {
 SimObject::regStats();
-
-totRequests
-.name(name() + ".tot_requests")
-.desc("Total number of requests made to the snoop filter.");
-
-hitSingleRequests
-.name(name() + ".hit_single_requests")
-.desc("Number of requests hitting in the snoop filter with a  
single "\

-  "holder of the requested data.");
-
-hitMultiRequests
-.name(name() + ".hit_multi_requests")
-.desc("Number of requests hitting in the snoop filter with  
multiple "\

-  "(>1) holders of the requested data.");
-
-totSnoops
-.name(name() + ".tot_snoops")
-.desc("Total number of snoops made to the snoop filter.");
-
-hitSingleSnoops
-.name(name() + ".hit_single_snoops")
-.desc("Number of snoops hitting in the snoop filter with a  
single "\

-  "holder of the requested data.");
-
-hitMultiSnoops
-.name(name() + ".hit_multi_snoops")
-.desc("Number of snoops hitting in the snoop filter with  
multiple "\

-  "(>1) holders of the requested data.");
 }
diff --git a/src/mem/snoop_filter.hh b/src/mem/snoop_filter.hh
index 8150494..abd66a8 100644
--- a/src/mem/snoop_filter.hh
+++ b/src/mem/snoop_filter.hh
@@ -94,7 +94,8 @@
 SnoopFilter (const SnoopFilterParams ) :
 SimObject(p), reqLookupResult(cachedLocations.end()),
 linesize(p.system->cacheLineSize()),  
lookupLatency(p.lookup_latency),

-maxEntryCount(p.max_capacity / p.system->cacheLineSize())
+maxEntryCount(p.max_capacity / p.system->cacheLineSize()),
+stats(this)
 {
 }

@@ -310,13 +311,17 @@
 };

 /** Statistics */
-Stats::Scalar totRequests;
-Stats::Scalar hitSingleRequests;
-Stats::Scalar hitMultiRequests;
+struct SnoopFilterStats : public Stats::Group {
+SnoopFilterStats(Stats::Group *parent);

-Stats::Scalar totSnoops;
-Stats::Scalar hitSingleSnoops;
-Stats::Scalar hitMultiSnoops;
+Stats::Scalar totRequests;
+Stats::Scalar hitSingleRequests;
+Stats::Scalar hitMultiRequests;
+
+Stats::Scalar totSnoops;
+Stats::Scalar hitSingleSnoops;
+

[gem5-dev] Change in gem5/gem5[develop]: mem-cache, stats: Stats update for snoop filter

2020-10-20 Thread Maryam Babaie (Gerrit) via gem5-dev
Maryam Babaie has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/36355 )



Change subject: mem-cache, stats: Stats update for snoop filter
..

mem-cache, stats: Stats update for snoop filter

Change-Id: I339bbc4268d5b9501421a2a6a76e5267422c87aa
---
M src/mem/snoop_filter.cc
M src/mem/snoop_filter.hh
2 files changed, 40 insertions(+), 45 deletions(-)



diff --git a/src/mem/snoop_filter.cc b/src/mem/snoop_filter.cc
index 7fa1f4e..3415f27 100644
--- a/src/mem/snoop_filter.cc
+++ b/src/mem/snoop_filter.cc
@@ -97,12 +97,12 @@
 // updateRequest.
 reqLookupResult.retryItem = sf_item;

-totRequests++;
+stats.totRequests++;
 if (is_hit) {
 if (interested.count() == 1)
-hitSingleRequests++;
+stats.hitSingleRequests++;
 else
-hitMultiRequests++;
+stats.hitMultiRequests++;
 }

 DPRINTF(SnoopFilter, "%s:   SF value %x.%x\n",
@@ -207,12 +207,12 @@

 SnoopMask interested = (sf_item.holder | sf_item.requested);

-totSnoops++;
+stats.totSnoops++;

 if (interested.count() == 1)
-hitSingleSnoops++;
+stats.hitSingleSnoops++;
 else
-hitMultiSnoops++;
+stats.hitMultiSnoops++;

 // ReadEx and Writes require both invalidation and exlusivity, while  
reads
 // require neither. Writebacks on the other hand require exclusivity  
but

@@ -387,42 +387,32 @@
 __func__, sf_item.requested, sf_item.holder);
 }

+SnoopFilter::SnoopFilterStats::SnoopFilterStats(Stats::Group *parent):
+Stats::Group(parent),
+ADD_STAT(totRequests,"Total number of requests made to the snoop filter."),
+ADD_STAT(hitSingleRequests,
+  "Number of requests hitting in the snoop filter with a  
single "\

+  "holder of the requested data."),
+ADD_STAT(hitMultiRequests,
+  "Number of requests hitting in the snoop filter with  
multiple "\

+  "(>1) holders of the requested data."),
+ADD_STAT(totSnoops,"Total number of snoops made to the snoop filter."),
+ADD_STAT(hitSingleSnoops,
+  "Number of snoops hitting in the snoop filter with a  
single "\

+  "holder of the requested data."),
+ADD_STAT(hitMultiSnoops,
+  "Number of snoops hitting in the snoop filter with  
multiple "\

+  "(>1) holders of the requested data.")
+{}
+
 void
 SnoopFilter::regStats()
 {
 SimObject::regStats();
-
-totRequests
-.name(name() + ".tot_requests")
-.desc("Total number of requests made to the snoop filter.");
-
-hitSingleRequests
-.name(name() + ".hit_single_requests")
-.desc("Number of requests hitting in the snoop filter with a  
single "\

-  "holder of the requested data.");
-
-hitMultiRequests
-.name(name() + ".hit_multi_requests")
-.desc("Number of requests hitting in the snoop filter with  
multiple "\

-  "(>1) holders of the requested data.");
-
-totSnoops
-.name(name() + ".tot_snoops")
-.desc("Total number of snoops made to the snoop filter.");
-
-hitSingleSnoops
-.name(name() + ".hit_single_snoops")
-.desc("Number of snoops hitting in the snoop filter with a  
single "\

-  "holder of the requested data.");
-
-hitMultiSnoops
-.name(name() + ".hit_multi_snoops")
-.desc("Number of snoops hitting in the snoop filter with  
multiple "\

-  "(>1) holders of the requested data.");
 }

 SnoopFilter *
-SnoopFilterParams::create() const
+SnoopFilterParams::create()
 {
-return new SnoopFilter(*this);
+return new SnoopFilter(this);
 }
diff --git a/src/mem/snoop_filter.hh b/src/mem/snoop_filter.hh
index 8150494..33fae8c 100644
--- a/src/mem/snoop_filter.hh
+++ b/src/mem/snoop_filter.hh
@@ -91,10 +91,11 @@

 typedef std::vector SnoopList;

-SnoopFilter (const SnoopFilterParams ) :
+SnoopFilter (const SnoopFilterParams *p) :
 SimObject(p), reqLookupResult(cachedLocations.end()),
-linesize(p.system->cacheLineSize()),  
lookupLatency(p.lookup_latency),

-maxEntryCount(p.max_capacity / p.system->cacheLineSize())
+linesize(p->system->cacheLineSize()),  
lookupLatency(p->lookup_latency),

+maxEntryCount(p->max_capacity / p->system->cacheLineSize()),
+stats(this)
 {
 }

@@ -310,13 +311,17 @@
 };

 /** Statistics */
-Stats::Scalar totRequests;
-Stats::Scalar hitSingleRequests;
-Stats::Scalar hitMultiRequests;
+struct SnoopFilterStats : public Stats::Group {
+SnoopFilterStats(Stats::Group *parent);

-Stats::Scalar totSnoops;
-Stats::Scalar hitSingleSnoops;
-Stats::Scalar hitMultiSnoops;
+Stats::Scalar totRequests;
+Stats::Scalar hitSingleRequests;
+Stats::Scalar hitMultiRequests;
+
+Stats::Scalar totSnoops;
+