Public Member Functions

prefetch_pool< BlockType > Class Template Reference
[Block scheduling sublayer]

Implements dynamically resizable prefetching pool. More...

#include <prefetch_pool.h>

Inheritance diagram for prefetch_pool< BlockType >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 prefetch_pool (unsigned_type init_size=1)
 Constructs pool.
virtual ~prefetch_pool ()
 Waits for completion of all ongoing read requests and frees memory.
unsigned_type size () const
 Returns number of owned blocks.
bool hint (bid_type bid)
 Gives a hint for prefetching a block.
request_ptr read (block_type *&block, bid_type bid)
 Reads block. If this block is cached block is not read but passed from the cache.
unsigned_type resize (unsigned_type new_size)
 Resizes size of the pool.

Detailed Description

template<class BlockType>
class prefetch_pool< BlockType >

Implements dynamically resizable prefetching pool.


Constructor & Destructor Documentation

template<class BlockType>
prefetch_pool< BlockType >::prefetch_pool ( unsigned_type  init_size = 1  )  [inline, explicit]

Constructs pool.

Parameters:
init_size initial number of blocks in the pool
template<class BlockType>
virtual prefetch_pool< BlockType >::~prefetch_pool (  )  [inline, virtual]

Waits for completion of all ongoing read requests and frees memory.


Member Function Documentation

template<class BlockType>
bool prefetch_pool< BlockType >::hint ( bid_type  bid  )  [inline]

Gives a hint for prefetching a block.

Parameters:
bid address of a block to be prefetched
Returns:
true if there was a free block to do prefetch and prefetching was scheduled, false otherwise
Note:
If there are no free blocks available (all blocks are already in reading or read but not retrieved by user calling read method) calling hint function has no effect

Referenced by queue< ValTp, BlkSz, AllocStr, SzTp >::pop(), and grow_shrink_stack2< Config_ >::set_prefetch_aggr().

template<class BlockType>
request_ptr prefetch_pool< BlockType >::read ( block_type *&  block,
bid_type  bid 
) [inline]

Reads block. If this block is cached block is not read but passed from the cache.

Parameters:
block block object, where data to be read to. If block was cached block 's ownership goes to the pool and block from cache is returned in block value.
bid address of the block
Warning:
block parameter must be allocated dynamically using new .
Returns:
request pointer object of read operation

Referenced by queue< ValTp, BlkSz, AllocStr, SzTp >::pop(), and grow_shrink_stack2< Config_ >::set_prefetch_aggr().

template<class BlockType>
unsigned_type prefetch_pool< BlockType >::resize ( unsigned_type  new_size  )  [inline]

Resizes size of the pool.

Parameters:
new_size desired size of the pool. If some blocks are used for prefetching, these blocks can't be freed. Only free blocks (not in prefetching) can be freed by reducing the size of the pool calling this method.
Returns:
new size of the pool

Referenced by queue< ValTp, BlkSz, AllocStr, SzTp >::queue().

template<class BlockType>
unsigned_type prefetch_pool< BlockType >::size (  )  const [inline]

The documentation for this class was generated from the following file: