MCPcopy Create free account
hub / github.com/Abc-Arbitrage/Disruptor-cpp / run

Method run

Disruptor.PerfTests/OneToOneSequencedThroughputTest.cpp:29–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27 }
28
29 std::int64_t OneToOneSequencedThroughputTest::run(Stopwatch& stopwatch)
30 {
31 m_taskScheduler->start(requiredProcessorCount());
32 TestTools::ScopeExitFunctor atScopeExit([this] { m_taskScheduler->stop(); });
33
34 auto expectedCount = m_batchEventProcessor->sequence()->value() + m_iterations;
35
36 m_latch->reset();
37 m_eventHandler->reset(m_latch, expectedCount);
38
39 auto processorTask = m_executor->execute([this] { m_batchEventProcessor->run(); });
40 stopwatch.start();
41
42 auto&& rb = *m_ringBuffer;
43
44 for (auto i = 0; i < m_iterations; ++i)
45 {
46 auto sequence = rb.next();
47 rb[sequence].value = i;
48 rb.publish(sequence);
49 }
50
51 m_latch->waitOne();
52 stopwatch.stop();
53 PerfTestUtil::waitForEventProcessorSequence(expectedCount, m_batchEventProcessor);
54 m_batchEventProcessor->halt();
55 processorTask.wait_for(std::chrono::seconds(10));
56
57 PerfTestUtil::failIfNot(m_expectedResult, m_eventHandler->value(),
58 "Handler should have processed " + std::to_string(m_expectedResult) + " events, but was: " + std::to_string(m_eventHandler->value()));
59
60 return m_iterations;
61 }
62
63 std::int32_t OneToOneSequencedThroughputTest::requiredProcessorCount() const
64 {

Callers

nothing calls this directly

Calls 12

failIfNotFunction · 0.85
waitOneMethod · 0.80
startMethod · 0.45
stopMethod · 0.45
valueMethod · 0.45
sequenceMethod · 0.45
resetMethod · 0.45
executeMethod · 0.45
nextMethod · 0.45
publishMethod · 0.45
haltMethod · 0.45

Tested by

no test coverage detected