#include <IcountFetchThreadSteerer.h>
Onikiri::IcountFetchThreadSteererに対する継承グラフ
Public メソッド | |
virtual void | Finalize () |
IcountFetchThreadSteerer () | |
virtual void | Initialize (InitPhase phase) |
virtual Thread * | SteerThread (bool update) |
virtual | ~IcountFetchThreadSteerer () |
IcountFetchThreadSteerer.h の 44 行で定義されています。
IcountFetchThreadSteerer::IcountFetchThreadSteerer | ( | ) |
IcountFetchThreadSteerer::~IcountFetchThreadSteerer | ( | ) | [virtual] |
void IcountFetchThreadSteerer::Finalize | ( | ) | [virtual] |
Onikiri::PhysicalResourceNodeを再定義しています。
IcountFetchThreadSteerer.cpp の 66 行で定義されています。
参照先 Onikiri::PhysicalResourceNode::ReleaseParam().
00067 { 00068 ReleaseParam(); 00069 }
関数の呼び出しグラフ:
void IcountFetchThreadSteerer::Initialize | ( | InitPhase | phase | ) | [virtual] |
IcountFetchThreadSteerer.cpp の 53 行で定義されています。
参照先 Onikiri::PhysicalResourceNode::CheckNodeInitialized()・Onikiri::PhysicalResourceNode::INIT_POST_CONNECTION・Onikiri::PhysicalResourceNode::INIT_PRE_CONNECTION・Onikiri::ParamExchange::LoadParam().
00054 { 00055 if (phase == INIT_PRE_CONNECTION){ 00056 LoadParam(); 00057 return; 00058 } 00059 if (phase == INIT_POST_CONNECTION){ 00060 00061 CheckNodeInitialized( "thread", m_thread ); 00062 00063 } 00064 }
関数の呼び出しグラフ:
Thread * IcountFetchThreadSteerer::SteerThread | ( | bool | update | ) | [virtual] |
Onikiri::FetchThreadSteererIFを実装しています。
IcountFetchThreadSteerer.cpp の 71 行で定義されています。
00072 { 00073 int threadCount = m_thread.GetSize(); 00074 std::vector<int> frontendInsnNum(threadCount,0); 00075 00076 // Count the number of instructions in front-end for each thread. 00077 for (int tid = 0; tid < threadCount; tid++) 00078 { 00079 InorderList* inorderList = m_thread[tid]->GetInorderList(); 00080 for (OpIterator op = inorderList->GetFrontOp(); op != OpIterator(0); op = inorderList->GetNextIndexOp(op)) 00081 { 00082 if ( !op->IsDispatched() || 00083 (!op->GetOpClass().IsNop() && op->GetScheduler()->IsInScheduler(op)) ) 00084 { 00085 frontendInsnNum[tid]++; 00086 } 00087 } 00088 } 00089 00090 // Find active thread 00091 int currentFetchThread = m_nextThread; 00092 int count = 0; 00093 bool found = true; 00094 while ( !m_thread[currentFetchThread]->IsActive() ) 00095 { 00096 currentFetchThread = (currentFetchThread + 1) % threadCount; 00097 count++; 00098 if( count > threadCount ){ 00099 found = false; 00100 break; 00101 } 00102 } 00103 00104 if( !found ){ 00105 if( update ) 00106 m_nextThread = currentFetchThread; 00107 return NULL; 00108 } 00109 00110 // Find a thread that has the smallest number of instructions in front-end. 00111 int targetThread = currentFetchThread; 00112 count = 0; 00113 do 00114 { 00115 currentFetchThread = (currentFetchThread + 1) % threadCount; 00116 if (m_thread[currentFetchThread]->IsActive() && frontendInsnNum[targetThread] > frontendInsnNum[currentFetchThread]) 00117 { 00118 targetThread = currentFetchThread; 00119 } 00120 count++; 00121 } while ( count <= threadCount ); 00122 00123 if( update ){ 00124 if ( m_evaluatedThread != targetThread ) 00125 { 00126 targetThread = m_evaluatedThread; 00127 m_nextThread = (targetThread + 1) % threadCount; 00128 } 00129 else 00130 { 00131 m_nextThread = (targetThread + 1) % threadCount; 00132 } 00133 } 00134 else 00135 { 00136 m_evaluatedThread = targetThread; 00137 } 00138 00139 return m_thread[targetThread]; 00140 }