config, cpu: fix progress interval for switched CPUs
authorMalek Musleh <malek.musleh@gmail.com>
Tue, 14 Apr 2015 16:01:10 +0000 (11:01 -0500)
committerMalek Musleh <malek.musleh@gmail.com>
Tue, 14 Apr 2015 16:01:10 +0000 (11:01 -0500)
This patch ensures that the CPU progress Event is triggered for the new set of
switched_cpus that get scheduled (e.g. during fast-forwarding). it also avoids
printing the interval state if the cpu is currently switched out.

Committed by: Nilay Vaish <nilay@cs.wisc.edu>

configs/common/Simulation.py
src/cpu/base.cc

index 230701c236f7302ffd1fdb566379f1e04b590e43..73874674c47e0964bf9e784275ec14cf20b7694e 100644 (file)
@@ -462,6 +462,7 @@ def run(options, root, testsys, cpu_class):
             switch_cpus[i].system =  testsys
             switch_cpus[i].workload = testsys.cpu[i].workload
             switch_cpus[i].clk_domain = testsys.cpu[i].clk_domain
+            switch_cpus[i].progress_interval = testsys.cpu[i].progress_interval
             # simulation period
             if options.maxinsts:
                 switch_cpus[i].max_insts_any_thread = options.maxinsts
index b761e714e56d067a3b6e45ee6f34d221f56357ba..4d8b09ed2572a57e58217a8f4fda86dfe12fe729 100644 (file)
@@ -94,6 +94,14 @@ void
 CPUProgressEvent::process()
 {
     Counter temp = cpu->totalOps();
+
+    if (_repeatEvent)
+      cpu->schedule(this, curTick() + _interval);
+
+    if(cpu->switchedOut()) {
+      return;
+    }
+
 #ifndef NDEBUG
     double ipc = double(temp - lastNumInst) / (_interval / cpu->clockPeriod());
 
@@ -107,9 +115,6 @@ CPUProgressEvent::process()
             temp - lastNumInst);
 #endif
     lastNumInst = temp;
-
-    if (_repeatEvent)
-        cpu->schedule(this, curTick() + _interval);
 }
 
 const char *