o3cpu: give a name to the activity recorder for better tracing
authorNathan Binkert <nate@binkert.org>
Wed, 21 Jan 2009 22:56:18 +0000 (14:56 -0800)
committerNathan Binkert <nate@binkert.org>
Wed, 21 Jan 2009 22:56:18 +0000 (14:56 -0800)
src/cpu/activity.cc
src/cpu/activity.hh
src/cpu/o3/cpu.cc

index 15e0556addab1710afab9da5f43a61bbfa2b9edd..a2a34edf9bad09f5c1946a02c7a98cf57ea4ac75 100644 (file)
  * Authors: Kevin Lim
  */
 
-#include <cstring>
+#include <string>
 
 #include "base/timebuf.hh"
 #include "cpu/activity.hh"
 
-ActivityRecorder::ActivityRecorder(int num_stages, int longest_latency,
-                                   int activity)
-    : activityBuffer(longest_latency, 0), longestLatency(longest_latency),
-      activityCount(activity), numStages(num_stages)
+using namespace std;
+
+ActivityRecorder::ActivityRecorder(const string &name, int num_stages,
+    int longest_latency, int activity)
+    : _name(name), activityBuffer(longest_latency, 0),
+      longestLatency(longest_latency), activityCount(activity),
+      numStages(num_stages)
 {
     stageActive = new bool[numStages];
     std::memset(stageActive, 0, numStages);
index e99927339f4802bab9b72aa38fc50771820f8e0b..d75ff150eeb3686355db3045b7680bb9fd58e0ea 100644 (file)
  * idle.  If count is zero, then the CPU can safely idle as it has no
  * more outstanding work to do.
  */
-class ActivityRecorder {
+class ActivityRecorder
+{
   public:
-    ActivityRecorder(int num_stages, int longest_latency, int count);
+    ActivityRecorder(const std::string &name, int num_stages,
+                     int longest_latency, int count);
 
     /** Records that there is activity this cycle. */
     void activity();
@@ -92,6 +94,10 @@ class ActivityRecorder {
     void validate();
 
   private:
+    // provide name() for DPRINTF.
+    std::string _name;
+    const std::string &name() { return _name; }
+
     /** Time buffer that tracks if any cycles has active communication
      *  in them.  It should be as long as the longest communication
      *  latency in the system.  Each time any time buffer is written,
index 7320d5638c49ec497440b6cdcaf997f1112260fc..f567c1868765d0b00d5749f7a463df92e660b6f4 100644 (file)
@@ -192,7 +192,7 @@ FullO3CPU<Impl>::FullO3CPU(DerivO3CPUParams *params)
       decodeQueue(params->backComSize, params->forwardComSize),
       renameQueue(params->backComSize, params->forwardComSize),
       iewQueue(params->backComSize, params->forwardComSize),
-      activityRec(NumStages,
+      activityRec(name(), NumStages,
                   params->backComSize + params->forwardComSize,
                   params->activity),