cpu: Turn BaseTrafficGen numSuppressed into a stat
authorMichiel W. van Tol <Michiel.VanTol@arm.com>
Tue, 24 Jul 2018 14:28:34 +0000 (15:28 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Fri, 24 Aug 2018 13:23:40 +0000 (13:23 +0000)
This is changing numSuppressed from being a warn only variable into
a Stat so that it is visible at the end of simulation.

Change-Id: I934782e796c898bfc0e773cc88c597a68e403272
Reviewed-on: https://gem5-review.googlesource.com/11849
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

src/cpu/testers/traffic_gen/base.cc
src/cpu/testers/traffic_gen/base.hh

index 41d005220b9d2981d6a2d06ecfabf5d2792a62a3..6778e417b9d39ff6d1539b8486c6f7b28ba1934d 100644 (file)
@@ -78,7 +78,6 @@ BaseTrafficGen::BaseTrafficGen(const BaseTrafficGenParams* p)
       retryPkt(NULL),
       retryPktTick(0),
       updateEvent([this]{ update(); }, name()),
-      numSuppressed(0),
       masterID(system->getMasterId(this))
 {
 }
@@ -186,9 +185,9 @@ BaseTrafficGen::update()
                     pkt->cmdString(), pkt->getAddr());
 
             ++numSuppressed;
-            if (numSuppressed % 10000)
+            if (!(static_cast<int>(numSuppressed.value()) % 10000))
                 warn("%s suppressed %d packets with non-memory addresses\n",
-                     name(), numSuppressed);
+                     name(), numSuppressed.value());
 
             delete pkt;
             pkt = nullptr;
@@ -314,6 +313,10 @@ BaseTrafficGen::regStats()
         .name(name() + ".numPackets")
         .desc("Number of packets generated");
 
+    numSuppressed
+        .name(name() + ".numSuppressed")
+        .desc("Number of suppressed packets to non-memory space");
+
     numRetries
         .name(name() + ".numRetries")
         .desc("Number of retries");
index 080bd7847c8e4e4af39ef9a7e5177b4b59ab7b6a..fe4229f2322fb521e9ed6ebda4487b096d4190ce 100644 (file)
@@ -163,7 +163,8 @@ class BaseTrafficGen : public MemObject
     /** Event for scheduling updates */
     EventFunctionWrapper updateEvent;
 
-    uint64_t numSuppressed;
+    /** Count the number of dropped requests. */
+    Stats::Scalar numSuppressed;
 
   private: // Stats
     /** Count the number of generated packets. */