cpu: convert thread_state to new style stats
[gem5.git] / src / cpu / thread_state.cc
index f4859f6d69e58f990d2b70aacbd4bed0de718108..a142f5741c7ee6834e203c665bd0f3eed68e5e9b 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "base/output.hh"
 #include "cpu/base.hh"
-#include "cpu/profile.hh"
 #include "mem/port.hh"
 #include "mem/port_proxy.hh"
 #include "mem/se_translating_port_proxy.hh"
 #include "sim/system.hh"
 
 ThreadState::ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process)
-    : numInst(0), numOp(0), numLoad(0), startNumLoad(0),
+    : numInst(0), numOp(0), threadStats(cpu, this),
+      numLoad(0), startNumLoad(0),
       _status(ThreadContext::Halted), baseCpu(cpu),
       _contextId(0), _threadId(_tid), lastActivate(0), lastSuspend(0),
-      profile(NULL), profileNode(NULL), profilePC(0),
       process(_process), physProxy(NULL), virtProxy(NULL),
       funcExeInst(0), storeCondFailures(0)
 {
@@ -119,16 +118,12 @@ ThreadState::getVirtProxy()
     return *virtProxy;
 }
 
-void
-ThreadState::profileClear()
+ThreadState::ThreadStateStats::ThreadStateStats(BaseCPU *cpu,
+                                                ThreadState *thread)
+      : Stats::Group(cpu, csprintf("thread%i", thread->threadId()).c_str()),
+      ADD_STAT(numInsts, "Number of Instructions committed"),
+      ADD_STAT(numOps, "Number of Ops committed"),
+      ADD_STAT(numMemRefs, "Number of Memory References")
 {
-    if (profile)
-        profile->clear();
-}
 
-void
-ThreadState::profileSample()
-{
-    if (profile)
-        profile->sample(profileNode, profilePC);
 }