inorder: set thread status'
authorKorey Sewell <ksewell@umich.edu>
Sun, 31 Jan 2010 23:28:12 +0000 (18:28 -0500)
committerKorey Sewell <ksewell@umich.edu>
Sun, 31 Jan 2010 23:28:12 +0000 (18:28 -0500)
set Active/Suspended/Halted status for threads.  useful for system when determining
if/when to exit simulation

src/cpu/inorder/cpu.cc
src/cpu/inorder/thread_context.hh

index 5db86b2583904d7ddd94e5ef499660b9526afe1b..d8fea79d9ae2b399ccf33d6a034638b836655bec 100644 (file)
@@ -711,6 +711,8 @@ InOrderCPU::activateThread(ThreadID tid)
 
         thread[tid]->lastActivate = curTick;            
 
+        tcBase(tid)->setStatus(ThreadContext::Active);    
+
         wakeCPU();
     }
 }
@@ -750,9 +752,11 @@ InOrderCPU::deactivateThread(ThreadID tid)
 
         removePipelineStalls(*thread_it);
 
-        //@TODO: change stage status' to Idle?
-
         activeThreads.erase(thread_it);
+
+        // Ideally, this should be triggered from the
+        // suspendContext/Thread functions
+        tcBase(tid)->setStatus(ThreadContext::Suspended);    
     }
 
     assert(!isThreadActive(tid));    
@@ -854,6 +858,8 @@ InOrderCPU::haltThread(ThreadID tid)
     squashThreadInPipeline(tid);   
     haltedThreads.push_back(tid);    
 
+    tcBase(tid)->setStatus(ThreadContext::Halted);    
+
     if (threadModel == SwitchOnCacheMiss) {        
         activateNextReadyContext();    
     }
@@ -872,6 +878,8 @@ InOrderCPU::suspendThread(ThreadID tid)
     deactivateThread(tid);
     suspendedThreads.push_back(tid);    
     thread[tid]->lastSuspend = curTick;    
+
+    tcBase(tid)->setStatus(ThreadContext::Suspended);    
 }
 
 void
index 820f3077fb03842b93a19e00bfee759a250b7437..6dd5f192f777e1e932f43693d575e9d99731b284 100644 (file)
@@ -64,7 +64,6 @@ class InOrderThreadContext : public ThreadContext
     /** Pointer to the thread state that this TC corrseponds to. */
     InOrderThreadState *thread;
 
-
     /** Returns a pointer to the ITB. */
     /** @TODO: PERF: Should we bind this to a pointer in constructor? */
     TheISA::TLB *getITBPtr() { return cpu->getITBPtr(); }