STXXL  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stxxl::block_prefetcher< block_type, bid_iterator_type > Class Template Reference

Detailed Description

template<typename block_type, typename bid_iterator_type>
class stxxl::block_prefetcher< block_type, bid_iterator_type >

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< block_type, bid_iterator_type >:
+ Collaboration diagram for stxxl::block_prefetcher< block_type, bid_iterator_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=default_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_type * pull_block ()
 Pulls next unconsumed block from the consumption sequence. More...
 

Protected Member Functions

block_type * wait (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_type * read_buffers
 
request_ptrread_reqs
 
unsigned_type seq_length
 

Private Types

typedef block_type::bid_type bid_type
 

Additional Inherited Members

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

Member Typedef Documentation

template<typename block_type , typename bid_iterator_type >
typedef block_type::bid_type stxxl::block_prefetcher< block_type, bid_iterator_type >::bid_type
private

Definition at line 57 of file block_prefetcher.h.

Constructor & Destructor Documentation

template<typename block_type , typename bid_iterator_type >
stxxl::block_prefetcher< block_type, bid_iterator_type >::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 = default_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 103 of file block_prefetcher.h.

References STXXL_VERBOSE1.

template<typename block_type , typename bid_iterator_type >
stxxl::block_prefetcher< block_type, bid_iterator_type >::~block_prefetcher ( )
inline

Frees used memory.

Definition at line 209 of file block_prefetcher.h.

Member Function Documentation

template<typename block_type , typename bid_iterator_type >
bool stxxl::block_prefetcher< block_type, bid_iterator_type >::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 160 of file block_prefetcher.h.

References STXXL_VERBOSE1.

template<typename block_type , typename bid_iterator_type >
bool stxxl::block_prefetcher< block_type, bid_iterator_type >::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 197 of file block_prefetcher.h.

template<typename block_type , typename bid_iterator_type >
unsigned_type stxxl::block_prefetcher< block_type, bid_iterator_type >::pos ( ) const
inline

Index of the next element in the consume sequence.

Definition at line 203 of file block_prefetcher.h.

template<typename block_type , typename bid_iterator_type >
block_type* stxxl::block_prefetcher< block_type, bid_iterator_type >::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 150 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< sorted_runs_type, CompareType_, AllocStr_ >::initialize().

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

Definition at line 80 of file block_prefetcher.h.

References STXXL_VERBOSE1.

Member Data Documentation

template<typename block_type , typename bid_iterator_type >
onoff_switch* stxxl::block_prefetcher< block_type, bid_iterator_type >::completed
protected

Definition at line 75 of file block_prefetcher.h.

template<typename block_type , typename bid_iterator_type >
bid_iterator_type stxxl::block_prefetcher< block_type, bid_iterator_type >::consume_seq_begin
protected

Definition at line 60 of file block_prefetcher.h.

template<typename block_type , typename bid_iterator_type >
bid_iterator_type stxxl::block_prefetcher< block_type, bid_iterator_type >::consume_seq_end
protected

Definition at line 61 of file block_prefetcher.h.

template<typename block_type , typename bid_iterator_type >
completion_handler stxxl::block_prefetcher< block_type, bid_iterator_type >::do_after_fetch
protected

Definition at line 78 of file block_prefetcher.h.

template<typename block_type , typename bid_iterator_type >
unsigned_type stxxl::block_prefetcher< block_type, bid_iterator_type >::nextconsume
protected

Definition at line 67 of file block_prefetcher.h.

template<typename block_type , typename bid_iterator_type >
unsigned_type stxxl::block_prefetcher< block_type, bid_iterator_type >::nextread
protected

Definition at line 66 of file block_prefetcher.h.

template<typename block_type , typename bid_iterator_type >
const int_type stxxl::block_prefetcher< block_type, bid_iterator_type >::nreadblocks
protected

Definition at line 69 of file block_prefetcher.h.

template<typename block_type , typename bid_iterator_type >
int_type* stxxl::block_prefetcher< block_type, bid_iterator_type >::pref_buffer
protected

Definition at line 76 of file block_prefetcher.h.

template<typename block_type , typename bid_iterator_type >
int_type* stxxl::block_prefetcher< block_type, bid_iterator_type >::prefetch_seq
protected

Definition at line 64 of file block_prefetcher.h.

template<typename block_type , typename bid_iterator_type >
bid_type* stxxl::block_prefetcher< block_type, bid_iterator_type >::read_bids
protected

Definition at line 73 of file block_prefetcher.h.

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

Definition at line 71 of file block_prefetcher.h.

template<typename block_type , typename bid_iterator_type >
request_ptr* stxxl::block_prefetcher< block_type, bid_iterator_type >::read_reqs
protected

Definition at line 72 of file block_prefetcher.h.

template<typename block_type , typename bid_iterator_type >
unsigned_type stxxl::block_prefetcher< block_type, bid_iterator_type >::seq_length
protected

Definition at line 62 of file block_prefetcher.h.


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