Public Member Functions | |
TestBox (void) | |
void | main (void) |
Private Types | |
typedef OutStrmBuf::char_type | char_type |
typedef rpa::orow_iterator< DataOut, OutStrmBuf > | OStrItPubT |
typedef rpa::row_buffer< DataOut, TmpnamBuf > | AutoInternBuf |
typedef AutoInternBuf | AutoIntBufVec [myNbThr] |
Private Member Functions | |
template<class InputRange, class ThrTree> | |
void | tstInput (size_t aSz, const ThrTree &aThrTree, const InputRange &aRange) |
template<class InputItr, class ThrTree> | |
void | tstNbThrs (InputItr aBeg, InputItr aEnd, size_t aNb, const ThrTree &aThrTree) |
template<class InputItr> | |
void | tstNbElts (InputItr aBeg, InputItr aEnd, size_t aNbElems) |
Static Private Member Functions | |
static const std::string & | info (void) |
Simpy returns an information string for displayin.g. | |
Private Attributes | |
AutoIntBufVec | myVecBufStream |
This is used as a pool of output buffers. |
typedef AutoInternBuf TestBox< OutStrmBuf, TmpnamBuf >::AutoIntBufVec[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 :
typedef rpa::row_buffer< DataOut, TmpnamBuf > TestBox< OutStrmBuf, TmpnamBuf >::AutoInternBuf [private] |
'InternBuf' is the base class of the streambuffer : It can be a filebuf, a stdio_filebuf, etc... It tells which can of optimisation can be applied and overall how will the buffer be stored. But the instantiated object is a TmpnamBuf which, as a derived
typedef OutStrmBuf::char_type TestBox< OutStrmBuf, TmpnamBuf >::char_type [private] |
typedef rpa::orow_iterator< DataOut, OutStrmBuf > TestBox< OutStrmBuf, TmpnamBuf >::OStrItPubT [private] |
This data structure is defined in rpa/containers/record.h. It allows to bufferize output streams.
TestBox< OutStrmBuf, TmpnamBuf >::TestBox | ( | void | ) | [inline] |
static const std::string& TestBox< OutStrmBuf, TmpnamBuf >::info | ( | void | ) | [inline, static, private] |
Simpy returns an information string for displayin.g.
void TestBox< OutStrmBuf, TmpnamBuf >::main | ( | void | ) | [inline] |
Does all tests for a given internal buffer type. It tries different input types, with different sizes. The input parameter is a suite of buffers which are already initialized.
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 four at each loop. It is possible to start from 0 or from the max.
void TestBox< OutStrmBuf, TmpnamBuf >::tstInput | ( | size_t | aSz, | |
const ThrTree & | aThrTree, | |||
const 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 pool 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.
The iterator given to and returned by the algorithm, stores the delimiter pointer, and does not copy it. This is not tested everywhere, but is always true.
void TestBox< OutStrmBuf, TmpnamBuf >::tstNbElts | ( | InputItr | aBeg, | |
InputItr | aEnd, | |||
size_t | aNbElems | |||
) | [inline, private] |
Do all tests for a given input container type, and a given number of input elements.
Starts the tests with different number of threads. The number of used threads is multiplied by two at each loop : This allows to make more extreme testing at a reduced CPU cost.
void TestBox< OutStrmBuf, TmpnamBuf >::tstNbThrs | ( | InputItr | aBeg, | |
InputItr | aEnd, | |||
size_t | aNb, | |||
const 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).
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.
AutoIntBufVec TestBox< OutStrmBuf, TmpnamBuf >::myVecBufStream [private] |
This is used as a pool of output buffers.