Public Member Functions | |
template<class IntrnStrmBuf> | |
void | main_streambuf (IntrnStrmBuf *aStrmBuf) |
void | main (void) |
Private Types | |
typedef OutStrmBuf::char_type | char_type |
typedef rpa::orow_iterator< DataOut, OutStrmBuf > | OStrItPubT |
typedef InternBuf | VecIntrnBuf [myNbThr] |
Private Member Functions | |
template<class InputRange, class ThrTree> | |
void | tstInput (size_t aSz, ThrTree aThrTree, InputRange aRange) |
template<class InputIter, class ThrTree> | |
void | tstNbThrs (InputIter aBeg, InputIter aEnd, size_t aNb, ThrTree aThrTree) |
template<class InputIter> | |
void | tstNbElts (InputIter aBeg, InputIter aEnd, size_t aNbElems) |
Private Attributes | |
VecIntrnBuf | myVecBufStream |
typedef OutStrmBuf::char_type T15_Buf< OutStrmBuf, InternBuf >::char_type [private] |
typedef rpa::orow_iterator< DataOut, OutStrmBuf > T15_Buf< OutStrmBuf, InternBuf >::OStrItPubT [private] |
This data structure is defined in rpa/containers/record.h. It allows to bufferize output streams.
typedef InternBuf T15_Buf< OutStrmBuf, InternBuf >::VecIntrnBuf[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 :
void T15_Buf< OutStrmBuf, InternBuf >::main | ( | void | ) | [inline] |
Does all tests for a given internal buffer type. It tries different input types, with different sizes.
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. We can use any kind of iterator as input.
void T15_Buf< OutStrmBuf, InternBuf >::main_streambuf | ( | IntrnStrmBuf * | aStrmBuf | ) | [inline] |
Creation and opening of temporary files. This is only when testing with row_buffer.
At this stage, the internal buffers are already created. They have the type 'row_buffer' : They can safely be associated with existing file stream buffers.
Plain call, with non-row_buffer, ready-to-use buffers.
It is not necessary to deassociate the row_buffer from the external buffers : This is safely done at destruction time.
void T15_Buf< OutStrmBuf, InternBuf >::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.
Writing through unlimited-size buffers. Instead of allocating the buffers on the stack, the calling program gives a pool of pre-allocated 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.
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.
Limited size buffering. Tries with several sizes.
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).
void T15_Buf< OutStrmBuf, InternBuf >::tstNbElts | ( | InputIter | aBeg, | |
InputIter | aEnd, | |||
size_t | aNbElems | |||
) | [inline, private] |
Do all tests for given input container type, and number of input elements. Internally, it tries different thread types.
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 T15_Buf< OutStrmBuf, InternBuf >::tstNbThrs | ( | InputIter | aBeg, | |
InputIter | 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).
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.
We skip these tests for the moment because they are not very significant because we have to simulate the atomicity anyway.
Dynamic scheduling with mutex synchronization.
Interleaved scheduling.
VecIntrnBuf T15_Buf< OutStrmBuf, InternBuf >::myVecBufStream [private] |
This is used as a pool of output buffers. There are not able to open themselves automatically, so we must loop upon them.