Stxxl
1.4.0
|
Implements dynamically resizable prefetching pool. More...
#include <prefetch_pool.h>
Classes | |
struct | bid_hash |
Public Types | |
typedef BlockType | block_type |
typedef block_type::bid_type | bid_type |
Public Member Functions | |
prefetch_pool (unsigned_type init_size=1) | |
Constructs pool. | |
void | swap (prefetch_pool &obj) |
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. | |
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. | |
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. | |
Protected Types | |
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 |
Protected Attributes | |
std::list< block_type * > | free_blocks |
hash_map_type | busy_blocks |
unsigned_type | free_blocks_size |
Implements dynamically resizable prefetching pool.
Definition at line 34 of file prefetch_pool.h.
typedef block_type::bid_type stxxl::prefetch_pool< BlockType >::bid_type |
Definition at line 38 of file prefetch_pool.h.
typedef BlockType stxxl::prefetch_pool< BlockType >::block_type |
Definition at line 37 of file prefetch_pool.h.
typedef hash_map_type::iterator stxxl::prefetch_pool< BlockType >::busy_blocks_iterator [protected] |
Definition at line 64 of file prefetch_pool.h.
typedef std::pair<block_type *, request_ptr> stxxl::prefetch_pool< BlockType >::busy_entry [protected] |
Definition at line 61 of file prefetch_pool.h.
typedef std::list<block_type *>::iterator stxxl::prefetch_pool< BlockType >::free_blocks_iterator [protected] |
Definition at line 63 of file prefetch_pool.h.
typedef compat_hash_map<bid_type, busy_entry, bid_hash>::result stxxl::prefetch_pool< BlockType >::hash_map_type [protected] |
Definition at line 62 of file prefetch_pool.h.
stxxl::prefetch_pool< BlockType >::prefetch_pool | ( | unsigned_type | init_size = 1 | ) | [inline, explicit] |
Constructs pool.
init_size | initial number of blocks in the pool |
Definition at line 76 of file prefetch_pool.h.
virtual stxxl::prefetch_pool< BlockType >::~prefetch_pool | ( | ) | [inline, virtual] |
Waits for completion of all ongoing read requests and frees memory.
Definition at line 91 of file prefetch_pool.h.
bool stxxl::prefetch_pool< BlockType >::hint | ( | bid_type | bid | ) | [inline] |
Gives a hint for prefetching a block.
bid | address of a block to be prefetched |
true
if there was a free block to do prefetch and prefetching was scheduled, false
otherwise read
method) calling hint
function has no effect Definition at line 121 of file prefetch_pool.h.
Referenced by main().
bool stxxl::prefetch_pool< BlockType >::hint | ( | bid_type | bid, |
write_pool< block_type > & | w_pool | ||
) | [inline] |
Definition at line 143 of file prefetch_pool.h.
References stxxl::write_pool< BlockType >::add(), and stxxl::write_pool< BlockType >::steal_request().
bool stxxl::prefetch_pool< BlockType >::in_prefetching | ( | bid_type | bid | ) | [inline] |
Definition at line 192 of file prefetch_pool.h.
bool stxxl::prefetch_pool< BlockType >::invalidate | ( | bid_type | bid | ) | [inline] |
Definition at line 174 of file prefetch_pool.h.
Referenced by main().
request_ptr stxxl::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.
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 |
block
parameter must be allocated dynamically using new
. Definition at line 203 of file prefetch_pool.h.
Referenced by main().
request_ptr stxxl::prefetch_pool< BlockType >::read | ( | block_type *& | block, |
bid_type | bid, | ||
write_pool< block_type > & | w_pool | ||
) | [inline] |
Definition at line 223 of file prefetch_pool.h.
References stxxl::write_pool< BlockType >::add(), and stxxl::write_pool< BlockType >::steal_request().
unsigned_type stxxl::prefetch_pool< BlockType >::resize | ( | unsigned_type | new_size | ) | [inline] |
Resizes size of the pool.
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. |
Definition at line 261 of file prefetch_pool.h.
Referenced by main().
unsigned_type stxxl::prefetch_pool< BlockType >::size | ( | ) | const [inline] |
Returns number of owned blocks.
Definition at line 112 of file prefetch_pool.h.
void stxxl::prefetch_pool< BlockType >::swap | ( | prefetch_pool< BlockType > & | obj | ) | [inline] |
Definition at line 83 of file prefetch_pool.h.
References stxxl::prefetch_pool< BlockType >::busy_blocks, stxxl::prefetch_pool< BlockType >::free_blocks, stxxl::prefetch_pool< BlockType >::free_blocks_size, and std::swap().
Referenced by std::swap().
hash_map_type stxxl::prefetch_pool< BlockType >::busy_blocks [protected] |
Definition at line 69 of file prefetch_pool.h.
Referenced by stxxl::prefetch_pool< BlockType >::swap().
std::list<block_type *> stxxl::prefetch_pool< BlockType >::free_blocks [protected] |
Definition at line 67 of file prefetch_pool.h.
Referenced by stxxl::prefetch_pool< BlockType >::swap().
unsigned_type stxxl::prefetch_pool< BlockType >::free_blocks_size [protected] |
Definition at line 71 of file prefetch_pool.h.
Referenced by stxxl::prefetch_pool< BlockType >::swap().