クラス Onikiri::ExecUnitReserver

#include <ExecUnitReserver.h>

Onikiri::ExecUnitReserverのコラボレーション図

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

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.h39 行で定義されています。


型定義

typedef fixed_sized_buffer< Reservation, RESERVATION_QUEUE_SIZE > Onikiri::ExecUnitReserver::ReservationQueue [protected]

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


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

ExecUnitReserver::ExecUnitReserver (  ) 

ExecUnitReserver.cpp39 行で定義されています。

00039                                    : 
00040     m_unitCount( 0 ),
00041     m_current( 0 )
00042 {
00043 
00044 }

ExecUnitReserver::~ExecUnitReserver (  ) 

ExecUnitReserver.cpp46 行で定義されています。

00047 {
00048 
00049 }


関数

void ExecUnitReserver::Begin (  ) 

ExecUnitReserver.cpp67 行で定義されています。

参照先 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.cpp72 行で定義されています。

参照先 Onikiri::fixed_sized_buffer< T, SIZE, Tag >::begin()Onikiri::fixed_sized_buffer< T, SIZE, Tag >::end()GetWheelIndex()m_resvQueuem_unitCountm_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.cpp57 行で定義されています。

参照先 m_currentm_wheel.

参照元 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.cpp51 行で定義されています。

参照先 m_unitCountm_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.cpp94 行で定義されています。

参照先 Onikiri::ExecUnitReserver::Reservation::countm_resvQueueOnikiri::ExecUnitReserver::Reservation::periodOnikiri::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.cpp103 行で定義されています。

参照先 ASSERTOnikiri::fixed_sized_buffer< T, SIZE, Tag >::begin()Onikiri::fixed_sized_buffer< T, SIZE, Tag >::end()GetWheelIndex()m_currentm_resvQueuem_unitCountm_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]

ExecUnitReserver.h74 行で定義されています。

参照元 GetWheelIndex()Update().

ReservationQueue Onikiri::ExecUnitReserver::m_resvQueue [protected]

ExecUnitReserver.h85 行で定義されています。

参照元 Begin()CanReserve()Reserve()Update().

int Onikiri::ExecUnitReserver::m_unitCount [protected]

ExecUnitReserver.h67 行で定義されています。

参照元 CanReserve()Initialize()Update().

std::vector< int > Onikiri::ExecUnitReserver::m_wheel [protected]

ExecUnitReserver.h71 行で定義されています。

参照元 CanReserve()GetWheelIndex()Initialize()Update().

const int Onikiri::ExecUnitReserver::RESERVATION_QUEUE_SIZE = 256 [static, protected]

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


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