クラス Onikiri::SimulationSystem

#include <SimulationSystem.h>

Onikiri::SimulationSystemに対する継承グラフ

Inheritance graph
[凡例]
Onikiri::SimulationSystemのコラボレーション図

Collaboration graph
[凡例]
すべてのメンバ一覧

Public メソッド

SystemContext * GetContext ()
void Run (SystemContext *context)
 SimulationSystem ()

Static Public 変数

static HookPoint< SimulationSystems_cycleBeginHook
static HookPoint< SimulationSystems_cycleEndHook
static HookPoint< SimulationSystems_cycleEvaluateHook
static HookPoint< SimulationSystems_cycleTransitionHook
static HookPoint< SimulationSystems_cycleUpdateHook
static HookPoint< SimulationSystem,
SimulationSystem
s_systemInitHook

Protected 型

typedef std::vector< ClockedResourceIF * > ClockedResourceList
typedef PriorityEventList::TimeWheelList TimeWheelList

Protected メソッド

void CycleBegin ()
void CycleEnd ()
void CycleEvaluate ()
void CycleEvent ()
void CycleTransition ()
void CycleUpdate ()
void InitializeResources ()
void InitializeResourcesBody ()
void SimulateCycle ()

Protected 変数

ClockedResourceList m_clockedResources
SystemContext * m_context
std::vector< CoreResourcesm_coreResources
std::vector< MemoryResourcesm_memResources
PriorityEventList m_priorityEventList
std::vector< ThreadResourcesm_threadResources
TimeWheelList m_timeWheels

構成

struct  CoreResources
struct  MemoryResources
struct  SchedulerResources
struct  ThreadResources

説明

SimulationSystem.h42 行で定義されています。


型定義

typedef std::vector<ClockedResourceIF*> Onikiri::SimulationSystem::ClockedResourceList [protected]

SimulationSystem.h83 行で定義されています。

typedef PriorityEventList::TimeWheelList Onikiri::SimulationSystem::TimeWheelList [protected]

SimulationSystem.h86 行で定義されています。


コンストラクタとデストラクタ

SimulationSystem::SimulationSystem (  ) 

SimulationSystem.cpp63 行で定義されています。

参照先 m_context.

00064 {
00065     m_context = NULL;
00066 }


関数

void SimulationSystem::CycleBegin (  )  [protected]

SimulationSystem.cpp228 行で定義されています。

参照先 m_clockedResources.

参照元 SimulateCycle().

00229 {
00230     ClockedResourceList::iterator end = m_clockedResources.end();
00231     for( ClockedResourceList::iterator i = m_clockedResources.begin(); i != end; ++i ){
00232         (*i)->Begin();
00233     }
00234 }

Here is the caller graph for this function:

void SimulationSystem::CycleEnd (  )  [protected]

SimulationSystem.cpp274 行で定義されています。

参照先 m_clockedResources.

参照元 SimulateCycle().

00275 {
00276     ClockedResourceList::iterator end = m_clockedResources.end();
00277     for( ClockedResourceList::iterator i = m_clockedResources.begin(); i != end; ++i ){
00278         (*i)->End();
00279     }
00280 }

Here is the caller graph for this function:

void SimulationSystem::CycleEvaluate (  )  [protected]

SimulationSystem.cpp236 行で定義されています。

参照先 Onikiri::PriorityEventList::BeginEvaluate()Onikiri::PriorityEventList::EndEvaluate()Onikiri::PriorityEventList::ExtractEvent()m_clockedResourcesm_priorityEventListm_timeWheelsOnikiri::PriorityEventList::TriggerEvaluate().

参照元 SimulateCycle().

00237 {
00238     m_priorityEventList.ExtractEvent( &m_timeWheels );
00239 
00240     m_priorityEventList.BeginEvaluate();
00241 
00242     ClockedResourceList::iterator end = m_clockedResources.end();
00243     for( ClockedResourceList::iterator i = m_clockedResources.begin(); i != end; ++i ){
00244         ClockedResourceIF* res = *i;
00245         m_priorityEventList.TriggerEvaluate( res->GetPriority() );
00246         res->Evaluate();
00247     }
00248 
00249     m_priorityEventList.EndEvaluate();
00250 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void Onikiri::SimulationSystem::CycleEvent (  )  [protected]

void SimulationSystem::CycleTransition (  )  [protected]

SimulationSystem.cpp252 行で定義されています。

参照先 m_clockedResources.

参照元 SimulateCycle().

00253 {
00254     ClockedResourceList::iterator end = m_clockedResources.end();
00255     for( ClockedResourceList::iterator i = m_clockedResources.begin(); i != end; ++i ){
00256         (*i)->Transition();
00257     }
00258 }

Here is the caller graph for this function:

void SimulationSystem::CycleUpdate (  )  [protected]

SimulationSystem.cpp260 行で定義されています。

参照先 Onikiri::PriorityEventList::BeginUpdate()Onikiri::PriorityEventList::EndUpdate()m_clockedResourcesm_priorityEventListOnikiri::PriorityEventList::TriggerUpdate().

参照元 SimulateCycle().

00261 {   
00262     m_priorityEventList.BeginUpdate();
00263 
00264     ClockedResourceList::iterator end = m_clockedResources.end();
00265     for( ClockedResourceList::iterator i = m_clockedResources.begin(); i != end; ++i ){
00266         ClockedResourceIF* res = *i;
00267         m_priorityEventList.TriggerUpdate( res->GetPriority() );
00268         res->TriggerUpdate();
00269     }
00270 
00271     m_priorityEventList.EndUpdate();
00272 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

SimulationSystem::SystemContext * SimulationSystem::GetContext (  ) 

SimulationSystem.cpp223 行で定義されています。

参照先 m_context.

00224 {
00225     return m_context;
00226 }

void SimulationSystem::InitializeResources (  )  [protected]

SimulationSystem.cpp138 行で定義されています。

参照先 Onikiri::HookType::HOOK_AFTEROnikiri::HookType::HOOK_AROUNDOnikiri::HookType::HOOK_BEFOREInitializeResourcesBody()s_systemInitHook.

参照元 Run().

00139 {
00140     s_systemInitHook.Trigger( this, this, HookType::HOOK_BEFORE );
00141     if( !s_systemInitHook.HasAround() ){
00142         InitializeResourcesBody();
00143         s_systemInitHook.Trigger( this, this, HookType::HOOK_AFTER );
00144     }
00145     else{
00146         s_systemInitHook.Trigger( this, this, HookType::HOOK_AROUND );
00147     }
00148 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SimulationSystem::InitializeResourcesBody (  )  [protected]

SimulationSystem.cpp151 行で定義されています。

参照先 Onikiri::PhysicalResourceArray< T >::GetSize()m_clockedResourcesm_contextm_coreResourcesm_memResourcesm_threadResourcesm_timeWheels.

参照元 InitializeResources().

00152 {
00153     PhysicalResourceArray<Core>&   core   = m_context->cores;
00154     PhysicalResourceArray<Thread>& thread = m_context->threads;
00155     PhysicalResourceArray<Cache>&  caches = m_context->caches;
00156 
00157     m_coreResources.resize( core.GetSize() );
00158     m_threadResources.resize( thread.GetSize() );
00159     m_memResources.resize( caches.GetSize() );
00160 
00161     for( int i = 0; i < thread.GetSize(); i++ ){
00162         ThreadResources& res = m_threadResources[i];
00163         res.memOrderManager = thread[i]->GetMemOrderManager();
00164     }
00165 
00166     //
00167     // Register clocked resources
00168     //
00169     for( int i = 0; i < caches.GetSize(); i++ ){
00170         m_clockedResources.push_back( caches[i] );
00171     }
00172 
00173     for( int i = 0; i < core.GetSize(); i++ ){
00174         CoreResources& res = m_coreResources[i];
00175 
00176         res.core = core[i];
00177         m_clockedResources.push_back( core[i]->GetRetirer() );
00178 
00179         for( int j = 0; j < core[i]->GetNumScheduler(); j++ ){
00180             Scheduler* scheduler = core[i]->GetScheduler( j );
00181             m_clockedResources.push_back( scheduler );
00182         }
00183 
00184         m_clockedResources.push_back( core[i]->GetDispatcher() );
00185         m_clockedResources.push_back( core[i]->GetRenamer() );
00186         m_clockedResources.push_back( core[i]->GetFetcher() );
00187 
00188         m_clockedResources.push_back( core[i] );
00189     }
00190 
00191     sort(
00192         m_clockedResources.begin(), 
00193         m_clockedResources.end(), 
00194         ClockedResourceBase::ComparePriority() 
00195     );
00196 
00197     //
00198     // Register time wheels 
00199     //
00200     for( int i = 0; i < caches.GetSize(); i++ ){
00201         m_timeWheels.push_back( caches[i]->GetLowerPipeline() );
00202     }
00203 
00204     for( int i = 0; i < core.GetSize(); i++ ){
00205         CoreResources& res = m_coreResources[i];
00206 
00207         res.core = core[i];
00208         m_timeWheels.push_back( core[i]->GetRetirer()->GetLowerPipeline() );
00209 
00210         for( int j = 0; j < core[i]->GetNumScheduler(); j++ ){
00211             Scheduler* scheduler = core[i]->GetScheduler( j );
00212             m_timeWheels.push_back( scheduler->GetLowerPipeline() );
00213         }
00214 
00215         m_timeWheels.push_back( core[i]->GetDispatcher()->GetLowerPipeline() );
00216         m_timeWheels.push_back( core[i]->GetRenamer()->GetLowerPipeline() );
00217         m_timeWheels.push_back( core[i]->GetFetcher()->GetLowerPipeline() );
00218     }
00219 
00220 
00221 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SimulationSystem::Run ( SystemContext *  context  ) 

SimulationSystem.cpp68 行で定義されています。

参照先 Onikiri::String::format()Onikiri::g_dumperInitializeResources()m_contextOnikiri::Dumper::SetCurrentCycle()Onikiri::Dumper::SetCurrentInsnCount()SimulateCycle().

参照元 Onikiri::SystemManager::RunSimulation().

00069 {
00070     try{
00071         m_context = context;
00072         InitializeResources();
00073 
00074         context->executedCycles = 1;
00075         s64 numInsns  = context->executionInsns;
00076         s64 numCycles = context->executionCycles;
00077 
00078         while(true){
00079             context->globalClock->Tick();
00080 
00081             for( int i = 0; i < context->threads.GetSize(); i++ ){
00082                 Thread* thread = context->threads[i];
00083                 g_dumper.SetCurrentInsnCount( thread, thread->GetCore()->GetRetirer()->GetNumRetiredInsns() );
00084                 g_dumper.SetCurrentCycle( thread, context->executedCycles );
00085             }
00086 
00087             SimulateCycle();
00088 
00089             bool exitSimulation = true;
00090             s64 retiredInsns = 0;
00091             for( int i = 0; i < context->cores.GetSize(); i++ ){
00092                 Core* core = context->cores[i];
00093                 if( !core->GetRetirer()->IsEndOfProgram() ){
00094                     // Next PC  0 ^CAI
00095                     exitSimulation = false;
00096                 }
00097                 retiredInsns += core->GetRetirer()->GetNumRetiredInsns();
00098             }
00099 
00100             // I
00101             if(exitSimulation){
00102                 break;
00103             }
00104             else if( numCycles > 0 ){
00105                 // タsTCNw
00106                 if( context->executedCycles >= numCycles ) 
00107                     break;
00108             }
00109             else{
00110                 // タsw
00111                 if( retiredInsns >= numInsns )
00112                     break;
00113             }
00114 
00115             ++context->executedCycles;
00116         }
00117 
00118         // ^CAupdate
00119         context->executedInsns.clear();
00120         for( int i = 0; i < context->threads.GetSize(); i++ ){
00121             context->executedInsns.push_back( context->threads[i]->GetInorderList()->GetRetiredInsns() );
00122         }
00123     }
00124     catch( std::runtime_error& error ){
00125         String msg;
00126         msg.format(
00127             "%s\n"
00128             "Last simulated cycle: %lld\n" ,
00129             error.what(),
00130             m_context->executedCycles
00131         );
00132 
00133         throw std::runtime_error( msg.c_str() );
00134     }
00135 }

関数の呼び出しグラフ:

Here is the caller graph for this function:

void SimulationSystem::SimulateCycle (  )  [protected]

SimulationSystem.cpp282 行で定義されています。

参照先 CycleBegin()CycleEnd()CycleEvaluate()CycleTransition()CycleUpdate()Onikiri::HookEntry()s_cycleBeginHooks_cycleEndHooks_cycleEvaluateHooks_cycleTransitionHooks_cycleUpdateHook.

参照元 Run().

00283 {
00284     if( s_cycleBeginHook.IsAnyHookRegistered()   || 
00285         s_cycleEvaluateHook.IsAnyHookRegistered() ||
00286         s_cycleTransitionHook.IsAnyHookRegistered() ||
00287         s_cycleUpdateHook.IsAnyHookRegistered() ||
00288         s_cycleEndHook.IsAnyHookRegistered()
00289     ){
00290         HookEntry( this, &SimulationSystem::CycleBegin,      &s_cycleBeginHook );
00291         HookEntry( this, &SimulationSystem::CycleEvaluate,   &s_cycleEvaluateHook );
00292         HookEntry( this, &SimulationSystem::CycleTransition, &s_cycleTransitionHook );
00293         HookEntry( this, &SimulationSystem::CycleUpdate,     &s_cycleUpdateHook );
00294         HookEntry( this, &SimulationSystem::CycleEnd,        &s_cycleEndHook );
00295     }
00296     else{
00297         CycleBegin();
00298         CycleEvaluate();
00299         CycleTransition();
00300         CycleUpdate();
00301         CycleEnd();
00302     }
00303 
00304 }

関数の呼び出しグラフ:

Here is the caller graph for this function:


変数

ClockedResourceList Onikiri::SimulationSystem::m_clockedResources [protected]

SimulationSystem.h84 行で定義されています。

参照元 CycleBegin()CycleEnd()CycleEvaluate()CycleTransition()CycleUpdate()InitializeResourcesBody().

SystemContext* Onikiri::SimulationSystem::m_context [protected]

SimulationSystem.h103 行で定義されています。

参照元 GetContext()InitializeResourcesBody()Run()SimulationSystem().

std::vector<CoreResources> Onikiri::SimulationSystem::m_coreResources [protected]

SimulationSystem.h79 行で定義されています。

参照元 InitializeResourcesBody().

std::vector<MemoryResources> Onikiri::SimulationSystem::m_memResources [protected]

SimulationSystem.h81 行で定義されています。

参照元 InitializeResourcesBody().

PriorityEventList Onikiri::SimulationSystem::m_priorityEventList [protected]

SimulationSystem.h89 行で定義されています。

参照元 CycleEvaluate()CycleUpdate().

std::vector<ThreadResources> Onikiri::SimulationSystem::m_threadResources [protected]

SimulationSystem.h80 行で定義されています。

参照元 InitializeResourcesBody().

TimeWheelList Onikiri::SimulationSystem::m_timeWheels [protected]

SimulationSystem.h87 行で定義されています。

参照元 CycleEvaluate()InitializeResourcesBody().

HookPoint< SimulationSystem > Onikiri::SimulationSystem::s_cycleBeginHook [static]

SimulationSystem.h54 行で定義されています。

参照元 Onikiri::SampleHookModule::Initialize()SimulateCycle().

HookPoint< SimulationSystem > Onikiri::SimulationSystem::s_cycleEndHook [static]

SimulationSystem.h58 行で定義されています。

参照元 SimulateCycle().

HookPoint< SimulationSystem > Onikiri::SimulationSystem::s_cycleEvaluateHook [static]

SimulationSystem.h55 行で定義されています。

参照元 Onikiri::SampleHookModule::Initialize()SimulateCycle().

HookPoint< SimulationSystem > Onikiri::SimulationSystem::s_cycleTransitionHook [static]

SimulationSystem.h56 行で定義されています。

参照元 SimulateCycle().

HookPoint< SimulationSystem > Onikiri::SimulationSystem::s_cycleUpdateHook [static]

SimulationSystem.h57 行で定義されています。

参照元 Onikiri::SampleHookModule::Initialize()SimulateCycle().

HookPoint< SimulationSystem > Onikiri::SimulationSystem::s_systemInitHook [static]

SimulationSystem.h51 行で定義されています。

参照元 InitializeResources().


このクラスの説明は次のファイルから生成されました:
Onikiri2に対してTue Jun 18 15:21:08 2013に生成されました。  doxygen 1.4.7