public OneToOneSequencedThroughputTest_Value()
    {
        _eventHandler = new AdditionEventHandler();
        _ringBuffer   = ValueRingBuffer <PerfValueEvent> .CreateSingleProducer(PerfValueEvent.EventFactory, _bufferSize, new YieldingWaitStrategy());

        var sequenceBarrier = _ringBuffer.NewBarrier();

        _eventProcessor = EventProcessorFactory.Create(_ringBuffer, sequenceBarrier, _eventHandler);
        _ringBuffer.AddGatingSequences(_eventProcessor.Sequence);
    }
    public OneToOneSequencedThroughputTest_Unmanaged()
    {
        _eventHandler = new AdditionEventHandler();
        _memory       = UnmanagedRingBufferMemory.Allocate(_bufferSize, PerfValueEvent.Size);
        _ringBuffer   = new UnmanagedRingBuffer <PerfValueEvent>(_memory, ProducerType.Single, new YieldingWaitStrategy());
        var sequenceBarrier = _ringBuffer.NewBarrier();

        _eventProcessor = EventProcessorFactory.Create(_ringBuffer, sequenceBarrier, _eventHandler);
        _ringBuffer.AddGatingSequences(_eventProcessor.Sequence);
    }
示例#3
0
    public PingPongSequencedLatencyTest_Value()
    {
        var pingBuffer = ValueRingBuffer <PerfValueEvent> .CreateSingleProducer(PerfValueEvent.EventFactory, _bufferSize, new BlockingWaitStrategy());

        var pongBuffer = ValueRingBuffer <PerfValueEvent> .CreateSingleProducer(PerfValueEvent.EventFactory, _bufferSize, new BlockingWaitStrategy());

        var pingBarrier = pingBuffer.NewBarrier();
        var pongBarrier = pongBuffer.NewBarrier();

        _pinger = new Pinger(pingBuffer, _iterations, _pauseNanos);
        _ponger = new Ponger(pongBuffer);

        _pingProcessor = EventProcessorFactory.Create(pongBuffer, pongBarrier, _pinger);
        _pongProcessor = EventProcessorFactory.Create(pingBuffer, pingBarrier, _ponger);

        pingBuffer.AddGatingSequences(_pongProcessor.Sequence);
        pongBuffer.AddGatingSequences(_pingProcessor.Sequence);
    }
 public void Setup()
 {
     _processor = EventProcessorFactory.Create(_ringBuffer, _ringBuffer.NewBarrier(), new XEventHandler(() => _processor.Halt()));
 }