Implements dynamically resizable prefetching pool.
More...
#include <prefetch_pool.h>
Inherits noncopyable.
|
typedef BlockType | block_type |
|
typedef block_type::bid_type | bid_type |
|
|
| prefetch_pool (unsigned_type init_size=1) |
| Constructs pool. More...
|
|
void | swap (prefetch_pool &obj) |
|
virtual | ~prefetch_pool () |
| Waits for completion of all ongoing read requests and frees memory. More...
|
|
unsigned_type | size () const |
| Returns number of owned blocks. More...
|
|
bool | hint (bid_type bid) |
| Gives a hint for prefetching a block. More...
|
|
bool | hint (bid_type bid, write_pool< block_type > &w_pool) |
|
bool | invalidate (bid_type bid) |
|
bool | in_prefetching (bid_type bid) |
|
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. More...
|
|
request_ptr | read (block_type *&block, bid_type bid, write_pool< block_type > &w_pool) |
|
unsigned_type | resize (unsigned_type new_size) |
| Resizes size of the pool. More...
|
|
|
typedef std::pair< block_type
*, request_ptr > | busy_entry |
|
typedef compat_hash_map
< bid_type, busy_entry,
bid_hash >::result | hash_map_type |
|
typedef std::list< block_type * >
::iterator | free_blocks_iterator |
|
typedef hash_map_type::iterator | busy_blocks_iterator |
|
|
std::list< block_type * > | free_blocks |
|
hash_map_type | busy_blocks |
|
unsigned_type | free_blocks_size |
|
template<class BlockType>
class prefetch_pool< BlockType >
Implements dynamically resizable prefetching pool.
template<class BlockType>
Constructs pool.
- Parameters
-
init_size | initial number of blocks in the pool |
template<class BlockType>
Waits for completion of all ongoing read requests and frees memory.
template<class BlockType>
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 read_write_pool< BlockType >::hint(), and read_write_pool< BlockType >::write().
template<class BlockType>
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 read_write_pool< BlockType >::read().
template<class BlockType>
unsigned_type prefetch_pool< BlockType >::resize |
( |
unsigned_type |
new_size | ) |
|
|
inline |
template<class BlockType>
The documentation for this class was generated from the following file: