# HG changeset patch
# User Korey Sewell <[EMAIL PROTECTED]>
# Date 1227564379 18000
# Node ID 749752ee7d161ae2791a81c93c126351179469e3
# Parent  b2b20a241e923c43a6978ea42fab9be4ead71220
[mq]: fix_mixie_per_stage_tracing

diff -r b2b20a241e92 -r 749752ee7d16 src/cpu/exetrace.cc
--- a/src/cpu/exetrace.cc       Fri Nov 21 21:28:36 2008 -0500
+++ b/src/cpu/exetrace.cc       Mon Nov 24 17:06:19 2008 -0500
@@ -45,26 +45,20 @@ using namespace TheISA;
 
 namespace Trace {
 
+inline void
+Trace::ExeTracerRecord::printTicks(std::ostream &outs)
+{
+    ccprintf(outs, "%7d: ", when);    
+}
+
 void
 Trace::ExeTracerRecord::dump()
 {
     ostream &outs = Trace::output();
 
-    if (IsOn(ExecTicks)) 
-      //      {
-      //if (!stageTrace) {
-       ccprintf(outs, "%7d: ", when);
-    /*} else {
-       //outs << dec << "\t";
-       ccprintf(outs, "");
-       for (int i=0; i < stageCycle.size(); i++) {
-         if (i < stageCycle.size() - 1)
-           outs << dec << stageCycle[i] << "-";
-         else
-           outs << dec << stageCycle[i] << ":";
-       }
-      }
-      }*/
+    if (IsOn(ExecTicks)){
+      printTicks(outs);
+    }
 
     outs << thread->getCpuPtr()->name() << " ";
 
diff -r b2b20a241e92 -r 749752ee7d16 src/cpu/exetrace.hh
--- a/src/cpu/exetrace.hh       Fri Nov 21 21:28:36 2008 -0500
+++ b/src/cpu/exetrace.hh       Mon Nov 24 17:06:19 2008 -0500
@@ -52,6 +52,8 @@ class ExeTracerRecord : public InstRecor
     {
     }
 
+  
+  virtual inline void printTicks(std::ostream &outs);
     void dump();
 };
 
diff -r b2b20a241e92 -r 749752ee7d16 src/cpu/mixie/cpu.cc
--- a/src/cpu/mixie/cpu.cc      Fri Nov 21 21:28:36 2008 -0500
+++ b/src/cpu/mixie/cpu.cc      Mon Nov 24 17:06:19 2008 -0500
@@ -155,7 +155,8 @@ MixieCPU::MixieCPU(Params *params)
       activityRec(NumStages, 10, params->activity),
       switchCount(0),
       deferRegistration(false/*params->deferRegistration*/),
-      numThreads(params->numThreads/*ThePipeline::MaxThreads*/),
+      stageTracing(true/*params->stageTracing*/),
+      numThreads(params->numThreads),
       numVirtProcs(1)
 {
     cpu_params = params;
diff -r b2b20a241e92 -r 749752ee7d16 src/cpu/mixie/cpu.hh
--- a/src/cpu/mixie/cpu.hh      Fri Nov 21 21:28:36 2008 -0500
+++ b/src/cpu/mixie/cpu.hh      Mon Nov 24 17:06:19 2008 -0500
@@ -665,6 +665,9 @@ class MixieCPU : public BaseCPU
 
     /** Whether or not the CPU should defer its registration. */
     bool deferRegistration;
+    
+    /** Per-Stage Instruction Tracing */
+    bool stageTracing;
 
     /** Is there a context switch pending? */
     bool contextSwitch;
diff -r b2b20a241e92 -r 749752ee7d16 src/cpu/mixie/first_stage.cc
--- a/src/cpu/mixie/first_stage.cc      Fri Nov 21 21:28:36 2008 -0500
+++ b/src/cpu/mixie/first_stage.cc      Mon Nov 24 17:06:19 2008 -0500
@@ -144,7 +144,7 @@ FirstStage::processInsts(unsigned tid)
 
 #if TRACING_ON
             inst->traceData =
-                tracer->getInstRecord(ThePipeline::NumStages, 
cpu->tcBase(tid));
+             tracer->getInstRecord(ThePipeline::NumStages, cpu->stageTracing, 
cpu->tcBase(tid));
 #endif      // TRACING_ON
 
             DPRINTF(RefCount, "creation: [tid:%i]: [sn:%i]: Refcount = %i.\n",
diff -r b2b20a241e92 -r 749752ee7d16 src/cpu/mixie/mixie_trace.cc
--- a/src/cpu/mixie/mixie_trace.cc      Fri Nov 21 21:28:36 2008 -0500
+++ b/src/cpu/mixie/mixie_trace.cc      Mon Nov 24 17:06:19 2008 -0500
@@ -43,8 +43,11 @@ namespace Trace {
 namespace Trace {
 
 inline void
-MixieTraceRecord::printTicks(std::ostream &outs)
+Trace::MixieTraceRecord::printTicks(std::ostream &outs)
 {
+  if (!stageTrace) {
+    ccprintf(outs, "%7d: ", when);    
+  } else {
     ccprintf(outs, "");
     for (int i=0; i < stageCycle.size(); i++) {
         if (i < stageCycle.size() - 1)
@@ -52,10 +55,12 @@ MixieTraceRecord::printTicks(std::ostrea
         else
             outs << dec << stageCycle[i] << ":";
     }
+  }
 }
 
+
 MixieTraceRecord *
-MixieTrace::getInstRecord(unsigned num_stages, ThreadContext *tc)
+MixieTrace::getInstRecord(unsigned num_stages, bool stage_tracing, 
ThreadContext *tc)
 {
     if (!IsOn(ExecEnable))
         return NULL;
@@ -63,14 +68,14 @@ MixieTrace::getInstRecord(unsigned num_s
     if (!Trace::enabled)
         return NULL;
 
-    return new MixieTraceRecord(num_stages, tc);
+    return new MixieTraceRecord(num_stages, stage_tracing, tc);
 }
 
 MixieTraceRecord *
 MixieTrace::getInstRecord(Tick when, ThreadContext *tc,
                       const StaticInstPtr staticInst, Addr pc)
 {
-    return new MixieTraceRecord(ThePipeline::NumStages, tc);
+  return new MixieTraceRecord(ThePipeline::NumStages, true, tc);
 }
 
 /* namespace Trace */ }
diff -r b2b20a241e92 -r 749752ee7d16 src/cpu/mixie/mixie_trace.hh
--- a/src/cpu/mixie/mixie_trace.hh      Fri Nov 21 21:28:36 2008 -0500
+++ b/src/cpu/mixie/mixie_trace.hh      Mon Nov 24 17:06:19 2008 -0500
@@ -50,13 +50,15 @@ class MixieTraceRecord : public ExeTrace
 class MixieTraceRecord : public ExeTracerRecord
 {
   public:
-    MixieTraceRecord(unsigned num_stages, ThreadContext *_thread, bool spec = 
false)
+  MixieTraceRecord(unsigned num_stages, bool _stage_tracing, ThreadContext 
*_thread, bool spec = false)
         : ExeTracerRecord(0, _thread, NULL, 0, spec)
     {
+      stageTrace = _stage_tracing;
         stageCycle.resize(num_stages);
     }
 
     // Trace stage-by-stage execution of instructions.
+    bool stageTrace;
     std::vector<Tick> stageCycle;
 
     void printTicks(std::ostream &outs);
@@ -64,7 +66,6 @@ class MixieTraceRecord : public ExeTrace
     void setStageCycle(int num_stage, Tick cur_cycle) { stageCycle[num_stage] 
= cur_cycle; }
     void setStaticInst(const StaticInstPtr &_staticInst) { staticInst = 
_staticInst; }
     void setPC(Addr _pc) { PC = _pc; }
-
 };
 
 class MixieTrace : public InstTracer
@@ -75,7 +76,7 @@ class MixieTrace : public InstTracer
     {}
 
     MixieTraceRecord *
-    getInstRecord(unsigned num_stages, ThreadContext *tc);
+    getInstRecord(unsigned num_stages, bool stage_tracing, ThreadContext *tc);
 
     virtual MixieTraceRecord *
         getInstRecord(Tick when, ThreadContext *tc,
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to