TestRow< OutStrmBuf, RowBufferType > Class Template Reference

List of all members.

Public Member Functions

 TestRow (void)
void main (void)
 Does all tests for one given internal buffer type.

Private Types

typedef OutStrmBuf::char_type char_type
typedef rpa::orow_iterator<
DataOut, OutStrmBuf > 
OStrItPubT
typedef RowBufferType RowBufferVect [myNbThr]

Private Member Functions

template<class InputRange, class ThrTree>
void tstInput (size_t aSz, ThrTree aThrTree, InputRange aRange)
template<class InputItr, class ThrTree>
void tstNbThrs (InputItr aBeg, InputItr aEnd, size_t aNb, ThrTree aThrTree)
void tstNbElts (const DataIn *aBeg, const DataIn *aEnd, size_t aNbElems)

Private Attributes

RowBufferVect myVecBufStream
 This is used as a pool of output buffers.

Detailed Description

template<class OutStrmBuf, class RowBufferType>
class TestRow< OutStrmBuf, RowBufferType >

This contains all steps levels of this program : Instanciation on different data types, various run-type parameters. 'OutStrmBuf' is the kind of output stream where results are written to. 'InternBuf' is the datatype internally used by 'obuf_iterator'. OutStrmBuf is the type of output. InternBuf : The type of buffer for each sub-thread.


Member Typedef Documentation

template<class OutStrmBuf, class RowBufferType>
typedef OutStrmBuf::char_type TestRow< OutStrmBuf, RowBufferType >::char_type [private]

template<class OutStrmBuf, class RowBufferType>
typedef rpa::orow_iterator< DataOut, OutStrmBuf > TestRow< OutStrmBuf, RowBufferType >::OStrItPubT [private]

This data structure is defined in rpa/containers/record.h. It allows to bufferize output streams.

template<class OutStrmBuf, class RowBufferType>
typedef RowBufferType TestRow< OutStrmBuf, RowBufferType >::RowBufferVect[myNbThr] [private]

This is a pool for per-thread buffers. There can be one and only one buffer per active sub-thread. The access modes of these buffers are :


Constructor & Destructor Documentation

template<class OutStrmBuf, class RowBufferType>
TestRow< OutStrmBuf, RowBufferType >::TestRow ( void   )  [inline]


Member Function Documentation

template<class OutStrmBuf, class RowBufferType>
void TestRow< OutStrmBuf, RowBufferType >::main ( void   )  [inline]

Does all tests for one given internal buffer type.

As usual, creates a big buffer of input data, all different. Then, various tries based on the number of elements. The number of elements is multiplied by eight at each loop. It is possible to start from 0 or from the max.

template<class OutStrmBuf, class RowBufferType>
template<class InputRange, class ThrTree>
void TestRow< OutStrmBuf, RowBufferType >::tstInput ( size_t  aSz,
ThrTree  aThrTree,
InputRange  aRange 
) [inline, private]

The input range is copied at each use. This is necessary because it is modified at execution. Tries various configurations of obuf_iterator into streams.

For buffering of unlimited size. At the end of the execution of each sub-thread, all thread-specific buffers are merged to the output iterator.

For writing the results with a std::ostream_iterator. Some buffer types have no default constructor, therefore we must use a function that will return a valid pointer.

The buffer type is encapsulated into something which provides a default constructor opening a temporary file, if needed.

The returned delimiter must ALWAYS be identical to the input.

Writing through unlimited-size buffers. Instead of allocating the buffers on the stack, the caller gives a pool of pre-created buffers.

For writing the results with a std::ostream_iterator. Some buffer types have no default constructor, therefore we must use a function that will return a valid pointer.

The type of streambuf is a streambuf_tmpnam too, but none will be created : Only the ones in the pool are used.

This mutex protects the output ostream iterator when each sub-thread periodically flushes its specific buffer into it.

This static array gives various buffers sizes to test. These are coefficients : This way, the tests are done in a reasonable time even with a lot of data. Another approach would be to take fixed values, and increase them if they are smaller than, for example, aSz / 1000000.

Limited size buffering. Tries with several sizes.

Nothing can work if the buffer size is zero. So it is not worth doing the test.

For writing the results with a std::ostream_iterator. Some buffer types have no default constructor, therefore we must use a function that will return a valid pointer.

This is the output iterator type : Fixed-buffer size, without already allocated buffer : They will be on the stack. The buffers are tagged to allow the automatic creation of temporary files.

The output delimiter must be the same as the input one. We reuse it for comparing the results.

For writing the results with a std::ostream_iterator. Some buffer types have no default constructor, therefore we must use a function that will return a valid pointer.

This is the output iterator type : Fixed-buffer size, with a set of already allocated buffer (One per thread). The type of streambuf is a streambuf_tmpnam too, but none will be created : Only the ones in the pool are used.

template<class OutStrmBuf, class RowBufferType>
void TestRow< OutStrmBuf, RowBufferType >::tstNbElts ( const DataIn aBeg,
const DataIn aEnd,
size_t  aNbElems 
) [inline, private]

Do all tests for a given input container type, and a given number of input elements. At each loop, change 'sync_with_stdio'.

Starts the tests with different number of threads. The number of used threads is multiplied by three at each loop : This allows to make more extreme testing at a reduced CPU cost.

At each loop, invert the synchronization mode.

template<class OutStrmBuf, class RowBufferType>
template<class InputItr, class ThrTree>
void TestRow< OutStrmBuf, RowBufferType >::tstNbThrs ( InputItr  aBeg,
InputItr  aEnd,
size_t  aNb,
ThrTree  aThrTree 
) [inline, private]

Given an input iterator type, a number of elements, and a thread tree, this tests using different kind of input ranges, that is, different kind of scheduling policies (Plus variations on run-time parameters).

We do not want to have smaller steps than that, for performance.

The number of steps is divided by two at each loop. If the number of elements is small, we will try with very small steps, otherwise bigger steps. Otherwise, the tests would take ages to run.

Dynamic scheduling with atomic synchronization.

Dynamic scheduling with mutex synchronization.

Interleaved scheduling.


Member Data Documentation

template<class OutStrmBuf, class RowBufferType>
RowBufferVect TestRow< OutStrmBuf, RowBufferType >::myVecBufStream [private]

This is used as a pool of output buffers.


The documentation for this class was generated from the following file:
Generated on Tue Sep 25 10:20:31 2007 for rpa by  doxygen 1.4.7