#include <ExecUnitReserver.h>
Onikiri::ExecUnitReserverのコラボレーション図
Public メソッド | |
void | Begin () |
bool | CanReserve (int n, int time, int period) |
ExecUnitReserver () | |
void | Initialize (int unitCount, int wheelSize) |
void | Reserve (int n, int time, int period) |
void | Update () |
~ExecUnitReserver () | |
Protected 型 | |
typedef fixed_sized_buffer< Reservation, RESERVATION_QUEUE_SIZE > | ReservationQueue |
Protected メソッド | |
int | GetWheelIndex (int delta) |
Protected 変数 | |
size_t | m_current |
ReservationQueue | m_resvQueue |
int | m_unitCount |
std::vector< int > | m_wheel |
Static Protected 変数 | |
static const int | RESERVATION_QUEUE_SIZE = 256 |
構成 | |
struct | Reservation |
ExecUnitReserver.h の 39 行で定義されています。
typedef fixed_sized_buffer< Reservation, RESERVATION_QUEUE_SIZE > Onikiri::ExecUnitReserver::ReservationQueue [protected] |
ExecUnitReserver.h の 84 行で定義されています。
ExecUnitReserver::ExecUnitReserver | ( | ) |
ExecUnitReserver.cpp の 39 行で定義されています。
00039 : 00040 m_unitCount( 0 ), 00041 m_current( 0 ) 00042 { 00043 00044 }
ExecUnitReserver::~ExecUnitReserver | ( | ) |
void ExecUnitReserver::Begin | ( | ) |
ExecUnitReserver.cpp の 67 行で定義されています。
参照先 Onikiri::fixed_sized_buffer< T, SIZE, Tag >::clear()・m_resvQueue.
参照元 Onikiri::ExecUnitBase::Begin().
00068 { 00069 m_resvQueue.clear(); 00070 }
関数の呼び出しグラフ:
Here is the caller graph for this function:
bool ExecUnitReserver::CanReserve | ( | int | n, | |
int | time, | |||
int | period | |||
) |
ExecUnitReserver.cpp の 72 行で定義されています。
参照先 Onikiri::fixed_sized_buffer< T, SIZE, Tag >::begin()・Onikiri::fixed_sized_buffer< T, SIZE, Tag >::end()・GetWheelIndex()・m_resvQueue・m_unitCount・m_wheel.
参照元 Onikiri::PipelinedExecUnit::CanReserve()・Onikiri::ExecUnit::CanReserve().
00073 { 00074 for( int p = 0; p < period; ++p ){ 00075 int now = time + p; 00076 int index = GetWheelIndex( now ); 00077 int count = m_wheel[ index ]; 00078 00079 for( ReservationQueue::iterator i = m_resvQueue.begin(); i != m_resvQueue.end(); ++i ){ 00080 int begin = i->time; 00081 int end = begin + i->period; 00082 if( begin <= now && now < end ){ 00083 count += i->count; 00084 } 00085 } 00086 00087 if( count + n > m_unitCount ){ 00088 return false; 00089 } 00090 } 00091 return true; 00092 }
関数の呼び出しグラフ:
Here is the caller graph for this function:
int ExecUnitReserver::GetWheelIndex | ( | int | delta | ) | [protected] |
ExecUnitReserver.cpp の 57 行で定義されています。
参照元 CanReserve()・Update().
00058 { 00059 int index = (int)m_current + delta; 00060 int size = (int)m_wheel.size(); 00061 if( index >= size ){ 00062 index -= size; 00063 } 00064 return index; 00065 }
Here is the caller graph for this function:
void ExecUnitReserver::Initialize | ( | int | unitCount, | |
int | wheelSize | |||
) |
ExecUnitReserver.cpp の 51 行で定義されています。
参照先 m_unitCount・m_wheel.
参照元 Onikiri::ExecUnitBase::Initialize().
00052 { 00053 m_unitCount = unitCount; 00054 m_wheel.resize( wheelSize, 0 ); 00055 }
Here is the caller graph for this function:
void ExecUnitReserver::Reserve | ( | int | n, | |
int | time, | |||
int | period | |||
) |
ExecUnitReserver.cpp の 94 行で定義されています。
参照先 Onikiri::ExecUnitReserver::Reservation::count・m_resvQueue・Onikiri::ExecUnitReserver::Reservation::period・Onikiri::fixed_sized_buffer< T, SIZE, Tag >::push_back()・Onikiri::ExecUnitReserver::Reservation::time.
参照元 Onikiri::PipelinedExecUnit::Reserve()・Onikiri::ExecUnit::Reserve().
00095 { 00096 Reservation res; 00097 res.count = n; 00098 res.time = time; 00099 res.period = period; 00100 m_resvQueue.push_back( res ); 00101 }
関数の呼び出しグラフ:
Here is the caller graph for this function:
void ExecUnitReserver::Update | ( | ) |
ExecUnitReserver.cpp の 103 行で定義されています。
参照先 ASSERT・Onikiri::fixed_sized_buffer< T, SIZE, Tag >::begin()・Onikiri::fixed_sized_buffer< T, SIZE, Tag >::end()・GetWheelIndex()・m_current・m_resvQueue・m_unitCount・m_wheel.
参照元 Onikiri::ExecUnitBase::Update().
00104 { 00105 // Update the reservation wheel based on the reservation queue. 00106 for( ReservationQueue::iterator i = m_resvQueue.begin(); i != m_resvQueue.end(); ++i ){ 00107 for( int cycle = 0; cycle < i->period; ++cycle ){ 00108 int index = GetWheelIndex( i->time + cycle ); 00109 m_wheel[ index ] += i->count; 00110 ASSERT( 00111 m_wheel[ index ] <= m_unitCount, 00112 "Execution units are reserved exceed a limit." 00113 ); 00114 } 00115 } 00116 00117 // Reset a count of this cycle. 00118 m_wheel[ GetWheelIndex(0) ] = 0; 00119 00120 m_current = GetWheelIndex(1); // Get an index for a next cycle. 00121 }
関数の呼び出しグラフ:
Here is the caller graph for this function:
size_t Onikiri::ExecUnitReserver::m_current [protected] |
int Onikiri::ExecUnitReserver::m_unitCount [protected] |
std::vector< int > Onikiri::ExecUnitReserver::m_wheel [protected] |
const int Onikiri::ExecUnitReserver::RESERVATION_QUEUE_SIZE = 256 [static, protected] |
ExecUnitReserver.h の 83 行で定義されています。