
Public Types | |
| typedef std_cxx1x::tuple < std::vector< Iterator > , ScratchData *, std::vector < CopyData >, unsigned int > | ItemType |
Public Member Functions | |
| IteratorRangeToItemStream (const Iterator &begin, const Iterator &end, const unsigned int buffer_size, const unsigned int chunk_size, const ScratchData &sample_scratch_data, const CopyData &sample_copy_data) | |
| ~IteratorRangeToItemStream () | |
| virtual void * | operator() (void *) |
Private Member Functions | |
| void | init_buffer_elements (const unsigned int element, const ScratchData &sample_scratch_data, const CopyData &sample_copy_data) |
Private Attributes | |
| std::pair< Iterator, Iterator > | remaining_iterator_range |
| std::vector< ItemType > | ring_buffer |
| unsigned int | n_emitted_items |
| const unsigned int | chunk_size |
A class that creates a sequence of items from a range of iterators.
Definition at line 140 of file work_stream.h.
| typedef std_cxx1x::tuple<std::vector<Iterator>, ScratchData*, std::vector<CopyData>, unsigned int> WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::ItemType |
A data type that we use to identify items to be worked on.
The first element indicates an array of iterators to work on; the second the scratch space; the third an array of copy data spaces; and the last the number of elements to work on. This last argument is an integer between one and chunk_size. The arrays have a length of chunk_size.
Definition at line 161 of file work_stream.h.
| WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::IteratorRangeToItemStream | ( | const Iterator & | begin, |
| const Iterator & | end, | ||
| const unsigned int | buffer_size, | ||
| const unsigned int | chunk_size, | ||
| const ScratchData & | sample_scratch_data, | ||
| const CopyData & | sample_copy_data | ||
| ) | [inline] |
Constructor. Take an iterator range, the size of a buffer that can hold items, and the sample additional data object that will be passed to each worker and copier function invokation.
Definition at line 172 of file work_stream.h.
References WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::init_buffer_elements(), Threads::TaskGroup< RT >::join_all(), Threads::new_task(), and WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::ring_buffer.
| WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::~IteratorRangeToItemStream | ( | ) | [inline] |
Destructor.
Definition at line 204 of file work_stream.h.
References WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::ring_buffer.
| virtual void* WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::operator() | ( | void * | ) | [inline, virtual] |
Create a item and return a pointer to it.
Definition at line 214 of file work_stream.h.
References WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::chunk_size, WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::n_emitted_items, WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::remaining_iterator_range, and WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::ring_buffer.
| void WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::init_buffer_elements | ( | const unsigned int | element, |
| const ScratchData & | sample_scratch_data, | ||
| const CopyData & | sample_copy_data | ||
| ) | [inline, private] |
Initialize the pointers and vector elements in the specified entry of the ring buffer.
Definition at line 287 of file work_stream.h.
References Assert, WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::chunk_size, StandardExceptions::ExcInternalError(), WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::remaining_iterator_range, and WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::ring_buffer.
Referenced by WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::IteratorRangeToItemStream().
std::pair<Iterator,Iterator> WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::remaining_iterator_range [private] |
The interval of iterators still to be worked on. This range will shrink over time.
Definition at line 254 of file work_stream.h.
Referenced by WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::init_buffer_elements(), and WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::operator()().
std::vector<ItemType> WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::ring_buffer [private] |
A ring buffer that will store items.
Definition at line 259 of file work_stream.h.
Referenced by WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::init_buffer_elements(), WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::IteratorRangeToItemStream(), WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::operator()(), and WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::~IteratorRangeToItemStream().
unsigned int WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::n_emitted_items [private] |
Counter for the number of emitted items. Each item may consist of up to chunk_size iterator elements.
Definition at line 266 of file work_stream.h.
Referenced by WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::operator()().
const unsigned int WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::chunk_size [private] |
Number of elements of the iterator range that each thread should work on sequentially; a large number makes sure that each thread gets a significant amount of work before the next task switch happens, whereas a small number is better for load balancing.
Definition at line 280 of file work_stream.h.
Referenced by WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::init_buffer_elements(), and WorkStream::internal::IteratorRangeToItemStream< Iterator, ScratchData, CopyData >::operator()().
documentation generated on Fri Feb 3 2012 06:04:18 by
doxygen
1.7.2