Repository navigation
Expand file tree
/
Copy pathOneToOneSequencedLongArrayThroughputTest.h
More file actions
72 lines (59 loc) · 2.07 KB
/
Copy pathOneToOneSequencedLongArrayThroughputTest.h
File metadata and controls
72 lines (59 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#pragma once
#include "Disruptor/BatchEventProcessor.h"
#include "Disruptor/IExecutor.h"
#include "Disruptor/ITaskScheduler.h"
#include "Disruptor/RingBuffer.h"
#include "Disruptor.PerfTests/IThroughputTest.h"
#include "Disruptor.PerfTests/LongArrayEventHandler.h"
namespace Disruptor
{
namespace PerfTests
{
/**
* UniCast a series of items between 1 publisher and 1 event processor.
*
* +----+ +-----+
* | P1 |--->| EP1 |
* +----+ +-----+
* Disruptor:
* ==========
* track to prevent wrap
* +------------------+
* | |
* | v
* +----+ +====+ +====+ +-----+
* | P1 |---›| RB |‹---| SB | | EP1 |
* +----+ +====+ +====+ +-----+
* claim get ^ |
* | |
* +--------+
* waitFor
* P1 - Publisher 1
* RB - RingBuffer
* SB - SequenceBarrier
* EP1 - EventProcessor 1
*
*/
class OneToOneSequencedLongArrayThroughputTest : public IThroughputTest
{
public:
OneToOneSequencedLongArrayThroughputTest();
std::int64_t run(Stopwatch& stopwatch) override;
std::int32_t requiredProcessorCount() const override;
private:
void waitForEventProcessorSequence(std::int64_t expectedCount);
const std::int32_t m_bufferSize = 1024 * 1;
#ifdef _DEBUG
const std::int64_t m_iterations = 100L * 100L * 1L;
#else
const std::int64_t m_iterations = 1000L * 1000L * 1L;
#endif
const std::int32_t m_arraySize = 2 * 1024;
std::shared_ptr< ITaskScheduler > m_taskScheduler;
std::shared_ptr< IExecutor > m_executor;
std::shared_ptr< RingBuffer< std::vector< std::int64_t > > > m_ringBuffer;
std::shared_ptr< LongArrayEventHandler > m_handler;
std::shared_ptr< BatchEventProcessor< std::vector< std::int64_t > > > m_batchEventProcessor;
};
} // namespace PerfTests
} // namespace Disruptor