cpu: Print progress messages in Trace CPU
authorRadhika Jagtap <radhika.jagtap@arm.com>
Tue, 16 Aug 2016 13:14:58 +0000 (14:14 +0100)
committerAndreas Sandberg <andreas.sandberg@arm.com>
Thu, 16 Mar 2017 13:52:40 +0000 (13:52 +0000)
This change adds the ability to print a message at intervals
of committed instruction count to indicate progress in the
trace replay.

Change-Id: I8363502354c42bfc52936d2627986598b63a5797
Reviewed-by: Rekai Gonzalez Alberquilla <rekai.gonzalezalberquilla@arm.com>
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/2321
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
src/cpu/trace/TraceCPU.py
src/cpu/trace/trace_cpu.cc
src/cpu/trace/trace_cpu.hh

index 3ec5795e35772f7d9259ed7db07f9130913bda38..e108b1a50e7b54f296d322261239a3b747801a70 100644 (file)
@@ -80,3 +80,10 @@ class TraceCPU(BaseCPU):
     # false by default
     enableEarlyExit = Param.Bool(False, "Exit when any one Trace CPU "\
                                  "completes execution")
+
+    # If progress msg interval is set to a non-zero value, it is treated as
+    # the interval of committed instructions at which an info message is
+    # printed.
+    progressMsgInterval = Param.Unsigned(0, "Interval of committed "\
+                                         "instructions at which to print a"\
+                                         " progress msg")
index 44da7df1ef3d535dc09d998e711c68b67804e958..7b59b49e07fc7ea424f93da8a3871e3ee8bfa36a 100644 (file)
@@ -62,13 +62,15 @@ TraceCPU::TraceCPU(TraceCPUParams *params)
         oneTraceComplete(false),
         traceOffset(0),
         execCompleteEvent(nullptr),
-        enableEarlyExit(params->enableEarlyExit)
+        enableEarlyExit(params->enableEarlyExit),
+        progressMsgInterval(params->progressMsgInterval),
+        progressMsgThreshold(params->progressMsgInterval)
 {
     // Increment static counter for number of Trace CPUs.
     ++TraceCPU::numTraceCPUs;
 
-    // Check that the python parameters for sizes of ROB, store buffer and load
-    // buffer do not overflow the corresponding C++ variables.
+    // Check that the python parameters for sizes of ROB, store buffer and
+    // load buffer do not overflow the corresponding C++ variables.
     fatal_if(params->sizeROB > UINT16_MAX, "ROB size set to %d exceeds the "
                 "max. value of %d.\n", params->sizeROB, UINT16_MAX);
     fatal_if(params->sizeStoreBuffer > UINT16_MAX, "ROB size set to %d "
@@ -90,6 +92,16 @@ TraceCPUParams::create()
     return new TraceCPU(this);
 }
 
+void
+TraceCPU::updateNumOps(uint64_t rob_num)
+{
+    numOps = rob_num;
+    if (progressMsgInterval != 0 && numOps.value() >= progressMsgThreshold) {
+        inform("%s: %i insts committed\n", name(), progressMsgThreshold);
+        progressMsgThreshold += progressMsgInterval;
+    }
+}
+
 void
 TraceCPU::takeOverFrom(BaseCPU *oldCPU)
 {
index 846a3e7c5d7b4728ef255a66a5e9081870604445..07c739c57085028f4e9db811a51c28981427af44 100644 (file)
@@ -177,7 +177,7 @@ class TraceCPU : public BaseCPU
      * Set the no. of ops when elastic data generator completes executing a
      * node.
      */
-    void updateNumOps(uint64_t rob_num) { numOps = rob_num; }
+    void updateNumOps(uint64_t rob_num);
 
     /* Pure virtual function in BaseCPU. Do nothing. */
     void wakeup(ThreadID tid = 0)
@@ -1122,6 +1122,19 @@ class TraceCPU : public BaseCPU
      */
     const bool enableEarlyExit;
 
+    /**
+      * Interval of committed instructions specified by the user at which a
+      * progress info message is printed
+      */
+    const uint64_t progressMsgInterval;
+
+    /*
+     * The progress msg threshold is kept updated to the next multiple of the
+     * progress msg interval. As soon as the threshold is reached, an info
+     * message is printed.
+     */
+    uint64_t progressMsgThreshold;
+
     Stats::Scalar numSchedDcacheEvent;
     Stats::Scalar numSchedIcacheEvent;