STXXL  1.4-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stxxl::block_prefetcher< BlockType, BidIteratorType > Class Template Reference

Detailed Description

template<typename BlockType, typename BidIteratorType>
class stxxl::block_prefetcher< BlockType, BidIteratorType >

Encapsulates asynchronous prefetching engine.

block_prefetcher overlaps I/Os with consumption of read data. Utilizes optimal asynchronous prefetch scheduling (by Peter Sanders et.al.)

Definition at line 55 of file block_prefetcher.h.

+ Inheritance diagram for stxxl::block_prefetcher< BlockType, BidIteratorType >:
+ Collaboration diagram for stxxl::block_prefetcher< BlockType, BidIteratorType >:

Public Types

typedef BidIteratorType bid_iterator_type
 
typedef block_type::bid_type bid_type
 
typedef BlockType block_type
 

Public Member Functions

 block_prefetcher (bid_iterator_type _cons_begin, bid_iterator_type _cons_end, int_type *_pref_seq, int_type _prefetch_buf_size, completion_handler do_after_fetch=completion_handler())
 Constructs an object and immediately starts prefetching. More...
 
 ~block_prefetcher ()
 Frees used memory. More...
 
bool block_consumed (block_type *&buffer)
 Exchanges buffers between prefetcher and application. More...
 
bool empty () const
 No more consumable blocks available, but can't delete the prefetcher, because not all blocks may have been returned, yet. More...
 
unsigned_type pos () const
 Index of the next element in the consume sequence. More...
 
block_typepull_block ()
 Pulls next unconsumed block from the consumption sequence. More...
 

Protected Member Functions

block_typewait (int_type iblock)
 

Protected Attributes

onoff_switchcompleted
 
bid_iterator_type consume_seq_begin
 
bid_iterator_type consume_seq_end
 
completion_handler do_after_fetch
 
unsigned_type nextconsume
 
unsigned_type nextread
 
const int_type nreadblocks
 
int_typepref_buffer
 
int_typeprefetch_seq
 
bid_typeread_bids
 
block_typeread_buffers
 
request_ptrread_reqs
 
unsigned_type seq_length
 

Additional Inherited Members

- Private Member Functions inherited from stxxl::noncopyable
 noncopyable ()
 

Member Typedef Documentation

template<typename BlockType , typename BidIteratorType >
typedef BidIteratorType stxxl::block_prefetcher< BlockType, BidIteratorType >::bid_iterator_type

Definition at line 59 of file block_prefetcher.h.

template<typename BlockType , typename BidIteratorType >
typedef block_type::bid_type stxxl::block_prefetcher< BlockType, BidIteratorType >::bid_type

Definition at line 61 of file block_prefetcher.h.

template<typename BlockType , typename BidIteratorType >
typedef BlockType stxxl::block_prefetcher< BlockType, BidIteratorType >::block_type

Definition at line 58 of file block_prefetcher.h.

Constructor & Destructor Documentation

template<typename BlockType , typename BidIteratorType >
stxxl::block_prefetcher< BlockType, BidIteratorType >::block_prefetcher ( bid_iterator_type  _cons_begin,
bid_iterator_type  _cons_end,
int_type _pref_seq,
int_type  _prefetch_buf_size,
completion_handler  do_after_fetch = completion_handler() 
)
inline

Constructs an object and immediately starts prefetching.

Parameters
_cons_beginbid_iterator pointing to the bid of the first block to be consumed
_cons_endbid_iterator pointing to the bid of the ( last + 1 ) block of consumption sequence
_pref_seqgives the prefetch order, is a pointer to the integer array that contains the indices of the blocks in the consumption sequence
_prefetch_buf_sizeamount of prefetch buffers to use
do_after_fetchunknown

Definition at line 107 of file block_prefetcher.h.

References STXXL_VERBOSE1.

template<typename BlockType , typename BidIteratorType >
stxxl::block_prefetcher< BlockType, BidIteratorType >::~block_prefetcher ( )
inline

Frees used memory.

Definition at line 211 of file block_prefetcher.h.

Member Function Documentation

template<typename BlockType , typename BidIteratorType >
bool stxxl::block_prefetcher< BlockType, BidIteratorType >::block_consumed ( block_type *&  buffer)
inline

Exchanges buffers between prefetcher and application.

Parameters
bufferpointer to the consumed buffer. After call if return value is true buffer contains valid pointer to the next unconsumed prefetched buffer.
Remarks
parameter buffer must be value returned by pull_block() or block_consumed() methods
Returns
false if there are no blocks to prefetch left, true if consumption sequence is not emptied

Definition at line 163 of file block_prefetcher.h.

References STXXL_VERBOSE1.

template<typename BlockType , typename BidIteratorType >
bool stxxl::block_prefetcher< BlockType, BidIteratorType >::empty ( ) const
inline

No more consumable blocks available, but can't delete the prefetcher, because not all blocks may have been returned, yet.

Definition at line 199 of file block_prefetcher.h.

template<typename BlockType , typename BidIteratorType >
unsigned_type stxxl::block_prefetcher< BlockType, BidIteratorType >::pos ( ) const
inline

Index of the next element in the consume sequence.

Definition at line 205 of file block_prefetcher.h.

template<typename BlockType , typename BidIteratorType >
block_type* stxxl::block_prefetcher< BlockType, BidIteratorType >::pull_block ( )
inline

Pulls next unconsumed block from the consumption sequence.

Returns
Pointer to the already prefetched block from the internal buffer pool

Definition at line 153 of file block_prefetcher.h.

References STXXL_VERBOSE1.

Referenced by stxxl::buf_istream_reverse< BlockType, BidIteratorType >::buf_istream_reverse(), and stxxl::stream::basic_runs_merger< typename runs_creator_type::sorted_runs_type, cmp_type, alloc_strategy_type >::initialize().

template<typename BlockType , typename BidIteratorType >
block_type* stxxl::block_prefetcher< BlockType, BidIteratorType >::wait ( int_type  iblock)
inlineprotected

Definition at line 84 of file block_prefetcher.h.

References STXXL_VERBOSE1.

Member Data Documentation

template<typename BlockType , typename BidIteratorType >
onoff_switch* stxxl::block_prefetcher< BlockType, BidIteratorType >::completed
protected

Definition at line 79 of file block_prefetcher.h.

template<typename BlockType , typename BidIteratorType >
bid_iterator_type stxxl::block_prefetcher< BlockType, BidIteratorType >::consume_seq_begin
protected

Definition at line 64 of file block_prefetcher.h.

template<typename BlockType , typename BidIteratorType >
bid_iterator_type stxxl::block_prefetcher< BlockType, BidIteratorType >::consume_seq_end
protected

Definition at line 65 of file block_prefetcher.h.

template<typename BlockType , typename BidIteratorType >
completion_handler stxxl::block_prefetcher< BlockType, BidIteratorType >::do_after_fetch
protected

Definition at line 82 of file block_prefetcher.h.

template<typename BlockType , typename BidIteratorType >
unsigned_type stxxl::block_prefetcher< BlockType, BidIteratorType >::nextconsume
protected

Definition at line 71 of file block_prefetcher.h.

template<typename BlockType , typename BidIteratorType >
unsigned_type stxxl::block_prefetcher< BlockType, BidIteratorType >::nextread
protected

Definition at line 70 of file block_prefetcher.h.

template<typename BlockType , typename BidIteratorType >
const int_type stxxl::block_prefetcher< BlockType, BidIteratorType >::nreadblocks
protected

Definition at line 73 of file block_prefetcher.h.

template<typename BlockType , typename BidIteratorType >
int_type* stxxl::block_prefetcher< BlockType, BidIteratorType >::pref_buffer
protected

Definition at line 80 of file block_prefetcher.h.

template<typename BlockType , typename BidIteratorType >
int_type* stxxl::block_prefetcher< BlockType, BidIteratorType >::prefetch_seq
protected

Definition at line 68 of file block_prefetcher.h.

template<typename BlockType , typename BidIteratorType >
bid_type* stxxl::block_prefetcher< BlockType, BidIteratorType >::read_bids
protected

Definition at line 77 of file block_prefetcher.h.

template<typename BlockType , typename BidIteratorType >
block_type* stxxl::block_prefetcher< BlockType, BidIteratorType >::read_buffers
protected

Definition at line 75 of file block_prefetcher.h.

template<typename BlockType , typename BidIteratorType >
request_ptr* stxxl::block_prefetcher< BlockType, BidIteratorType >::read_reqs
protected

Definition at line 76 of file block_prefetcher.h.

template<typename BlockType , typename BidIteratorType >
unsigned_type stxxl::block_prefetcher< BlockType, BidIteratorType >::seq_length
protected

Definition at line 66 of file block_prefetcher.h.


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