Hoa Nguyen has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/36296 )

Change subject: cpu,stats: Fix incorrect stat names
......................................................................

cpu,stats: Fix incorrect stat names

Previously, ThreadStateStats uses ThreadState::threadId() to
determine the name of the stats. However, in the ThreadState
constructor, ThreadStateStats is initialized before ThreadState
is intialized. As a result, the name of ThreadStateStats has
a wrong ThreadID.

This commit uses ThreadID instead of ThreadState to determine
the name of the stats.

This causes a name collision between ThreadStateStats and
ExecContextStats as both have the name of "thread_[tid]".
Ideally, those stats should be merged to the BaseSimpleCPU.
However, both ThreadStateStats and ExecContextStats have
a stat named numInsts. So, for now, ExecContextStats will
have a name of "exec_context.thread_[tid]", while ThreadStateStats
keeps its name.

Change-Id: If9a21549f98bd6e3ce6dc29bdf183e8fd5f51a67
Signed-off-by: Hoa Nguyen <hoangu...@ucdavis.edu>
---
M src/cpu/thread_state.cc
M src/cpu/thread_state.hh
2 files changed, 4 insertions(+), 4 deletions(-)



diff --git a/src/cpu/thread_state.cc b/src/cpu/thread_state.cc
index a142f57..5e59eb2 100644
--- a/src/cpu/thread_state.cc
+++ b/src/cpu/thread_state.cc
@@ -39,7 +39,7 @@
 #include "sim/system.hh"

 ThreadState::ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process)
-    : numInst(0), numOp(0), threadStats(cpu, this),
+    : numInst(0), numOp(0), threadStats(cpu, _tid),
       numLoad(0), startNumLoad(0),
       _status(ThreadContext::Halted), baseCpu(cpu),
       _contextId(0), _threadId(_tid), lastActivate(0), lastSuspend(0),
@@ -119,8 +119,8 @@
 }

 ThreadState::ThreadStateStats::ThreadStateStats(BaseCPU *cpu,
-                                                ThreadState *thread)
- : Stats::Group(cpu, csprintf("thread%i", thread->threadId()).c_str()),
+                                                const ThreadID& tid)
+      : Stats::Group(cpu, csprintf("thread_%i", tid).c_str()),
       ADD_STAT(numInsts, "Number of Instructions committed"),
       ADD_STAT(numOps, "Number of Ops committed"),
       ADD_STAT(numMemRefs, "Number of Memory References")
diff --git a/src/cpu/thread_state.hh b/src/cpu/thread_state.hh
index 3ac473d..53817c8 100644
--- a/src/cpu/thread_state.hh
+++ b/src/cpu/thread_state.hh
@@ -111,7 +111,7 @@
     // Defining the stat group
     struct ThreadStateStats : public Stats::Group
     {
-        ThreadStateStats(BaseCPU *cpu, ThreadState *thread);
+        ThreadStateStats(BaseCPU *cpu, const ThreadID& thread);
         /** Stat for number instructions committed. */
         Stats::Scalar numInsts;
         /** Stat for number ops (including micro ops) committed. */

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/36296
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: If9a21549f98bd6e3ce6dc29bdf183e8fd5f51a67
Gerrit-Change-Number: 36296
Gerrit-PatchSet: 1
Gerrit-Owner: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to