public MultiCast1P3CDisruptorWithAffinityPerfTest()
            : base(100 * Million)
        {
            _scheduler = new RoundRobinThreadAffinedTaskScheduler(4);
            _disruptor = new Disruptor<ValueEvent>(() => new ValueEvent(), Size, _scheduler, ProducerType.MULTI, new YieldingWaitStrategy());

            _latch = new CountdownEvent(3);

            _handler1 = new ValueMutationEventHandler(Operation.Addition, Iterations, _latch);
            _handler2 = new ValueMutationEventHandler(Operation.Substraction, Iterations, _latch);
            _handler3 = new ValueMutationEventHandler(Operation.And, Iterations, _latch);

            _disruptor.HandleEventsWith(_handler1, _handler2, _handler3);
            _ringBuffer = _disruptor.GetRingBuffer;
        }
        public MultiCast1P3CDisruptorPerfTest()
            : base(100 * Million)
        {
            _disruptor = new Dsl.Disruptor<ValueEvent>(() => new ValueEvent(),
                                                      new SingleThreadedClaimStrategy(Size),
                                                      new YieldingWaitStrategy());

            _latch = new CountdownEvent(3);

            _handler1 = new ValueMutationEventHandler(Operation.Addition, Iterations, _latch);
            _handler2 = new ValueMutationEventHandler(Operation.Substraction, Iterations, _latch);
            _handler3 = new ValueMutationEventHandler(Operation.And, Iterations, _latch);

            _disruptor.HandleEventsWith(_handler1, _handler2, _handler3);
            _ringBuffer = _disruptor.RingBuffer;
        }
        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());
        }