本文整理汇总了C#中RingBuffer.AddGatingSequences方法的典型用法代码示例。如果您正苦于以下问题:C# RingBuffer.AddGatingSequences方法的具体用法?C# RingBuffer.AddGatingSequences怎么用?C# RingBuffer.AddGatingSequences使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RingBuffer
的用法示例。
在下文中一共展示了RingBuffer.AddGatingSequences方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OneToOneSequencedPollerThroughputTest
public OneToOneSequencedPollerThroughputTest()
{
_ringBuffer = RingBuffer<ValueEvent>.CreateSingleProducer(ValueEvent.EventFactory, _bufferSize, new YieldingWaitStrategy());
_poller = _ringBuffer.NewPoller();
_ringBuffer.AddGatingSequences(_poller.Sequence);
_pollRunnable = new PollRunnable(_poller);
}
示例2: OneToOneSequencedLongArrayThroughputTest
public OneToOneSequencedLongArrayThroughputTest()
{
_ringBuffer = RingBuffer<long[]>.CreateSingleProducer(() => new long[_arraySize], _bufferSize, new YieldingWaitStrategy());
var sequenceBarrier = _ringBuffer.NewBarrier();
_handler = new LongArrayEventHandler();
_batchEventProcessor = new BatchEventProcessor<long[]>(_ringBuffer, sequenceBarrier, _handler);
_ringBuffer.AddGatingSequences(_batchEventProcessor.Sequence);
}
示例3: OneToOneSequencedBatchThroughputTest
public OneToOneSequencedBatchThroughputTest()
{
_ringBuffer = RingBuffer<ValueEvent>.CreateSingleProducer(ValueEvent.EventFactory, _bufferSize, new YieldingWaitStrategy());
var sequenceBarrier = _ringBuffer.NewBarrier();
_handler = new ValueAdditionEventHandler();
_batchEventProcessor = new BatchEventProcessor<ValueEvent>(_ringBuffer, sequenceBarrier, _handler);
_ringBuffer.AddGatingSequences(_batchEventProcessor.Sequence);
}
示例4: Setup
public void Setup()
{
_ringBuffer = new RingBuffer<StubEvent>(()=>new StubEvent(-1), 16);
_sequenceBarrier = _ringBuffer.NewBarrier();
_batchHandlerMock = new Mock<IEventHandler<StubEvent>>();
_countDownEvent = new CountdownEvent(1);
_batchEventProcessor = new BatchEventProcessor<StubEvent>(_ringBuffer, _sequenceBarrier, _batchHandlerMock.Object);
_ringBuffer.AddGatingSequences(_batchEventProcessor.Sequence);
}
示例5: SetUp
public void SetUp()
{
_ringBuffer = RingBuffer<StubEvent>.CreateMultiProducer(() => new StubEvent(-1), 64);
_eventProcessorMock1 = new Mock<IEventProcessor>();
_eventProcessorMock2 = new Mock<IEventProcessor>();
_eventProcessorMock3 = new Mock<IEventProcessor>();
_ringBuffer.AddGatingSequences(new NoOpEventProcessor<StubEvent>(_ringBuffer).Sequence);
}
示例6: OneToThreeSequencedThroughputTest
public OneToThreeSequencedThroughputTest()
{
for (long i = 0; i < _iterations; i++)
{
_results[0] = Operation.Addition.Op(_results[0], i);
_results[1] = Operation.Subtraction.Op(_results[1], i);
_results[2] = Operation.And.Op(_results[2], i);
}
_ringBuffer = RingBuffer<ValueEvent>.CreateSingleProducer(ValueEvent.EventFactory, _bufferSize, new YieldingWaitStrategy());
var sequenceBarrier = _ringBuffer.NewBarrier();
_handlers[0] = new ValueMutationEventHandler(Operation.Addition);
_handlers[1] = new ValueMutationEventHandler(Operation.Subtraction);
_handlers[2] = new ValueMutationEventHandler(Operation.And);
for (var i = 0; i < _numEventProcessors; i++)
{
_batchEventProcessors[i] = new BatchEventProcessor<ValueEvent>(_ringBuffer, sequenceBarrier, _handlers[i]);
}
_ringBuffer.AddGatingSequences(_batchEventProcessors.Select(x => x.Sequence).ToArray());
}
示例7: OnePublisherToThreeProcessorDiamondThroughputTest
public OnePublisherToThreeProcessorDiamondThroughputTest()
: base(TestName, 1000L * 1000L * 100L)
{
ringBuffer = RingBuffer<FizzBuzzEvent>.CreateSingleProducer(() => new FizzBuzzEvent(), 1024 * 8, new YieldingWaitStrategy());
sequenceBarrier = ringBuffer.NewBarrier();
batchProcessorFizz = new BatchEventProcessor<FizzBuzzEvent>(ringBuffer, sequenceBarrier, fizzHandler);
batchProcessorBuzz = new BatchEventProcessor<FizzBuzzEvent>(ringBuffer, sequenceBarrier, buzzHandler);
sequenceBarrierFizzBuzz = ringBuffer.NewBarrier(batchProcessorFizz.Sequence, batchProcessorBuzz.Sequence);
batchProcessorFizzBuzz = new BatchEventProcessor<FizzBuzzEvent>(ringBuffer, sequenceBarrierFizzBuzz, fizzBuzzHandler);
ringBuffer.AddGatingSequences(batchProcessorFizzBuzz.Sequence);
}
开发者ID:bingyang001,项目名称:disruptor-net-3.3.0-alpha,代码行数:15,代码来源:OnePublisherToThreeProcessorDiamondThroughputTest.cs