Formatting & doxygen docs for new syscall emulation code.
[gem5.git] / cpu / simple_cpu / simple_cpu.cc
index 8149023906d25016c90e5e7bf913778943d77a52..476f28ea003aea0d207c1ce9f43a959bb7c0e3a5 100644 (file)
@@ -70,7 +70,6 @@
 #else // !FULL_SYSTEM
 #include "eio/eio.hh"
 #include "mem/functional_mem/functional_memory.hh"
-#include "sim/prog.hh"
 #endif // FULL_SYSTEM
 
 using namespace std;
@@ -159,8 +158,9 @@ SimpleCPU::SimpleCPU(const string &_name, Process *_process,
     memReq->data = new uint8_t[64];
 
     numInst = 0;
+    startNumInst = 0;
     numLoad = 0;
-    last_idle = 0;
+    startNumLoad = 0;
     lastIcacheStall = 0;
     lastDcacheStall = 0;
 
@@ -171,7 +171,6 @@ SimpleCPU::~SimpleCPU()
 {
 }
 
-
 void
 SimpleCPU::switchOut()
 {
@@ -217,6 +216,8 @@ SimpleCPU::execCtxStatusChg(int thread_num) {
 void
 SimpleCPU::regStats()
 {
+    using namespace Statistics;
+
     BaseCPU::regStats();
 
     numInsts
@@ -229,11 +230,6 @@ SimpleCPU::regStats()
         .desc("Number of memory references")
         ;
 
-    idleCycles
-        .name(name() + ".idle_cycles")
-        .desc("Number of idle cycles")
-        ;
-
     idleFraction
         .name(name() + ".idle_fraction")
         .desc("Percentage of idle cycles")
@@ -251,12 +247,16 @@ SimpleCPU::regStats()
         .prereq(dcacheStallCycles)
         ;
 
-    idleFraction = idleCycles / simTicks;
-
-    numInsts = Statistics::scalar(numInst);
+    numInsts = Statistics::scalar(numInst) - Statistics::scalar(startNumInst);
     simInsts += numInsts;
 }
 
+void
+SimpleCPU::resetStats()
+{
+    startNumInst = numInst;
+}
+
 void
 SimpleCPU::serialize(ostream &os)
 {