public OneToOneSequencedThroughputTest_AsyncBatchHandler()
    {
        _eventHandler = new AdditionAsyncBatchEventHandler();
        //_ringBuffer = RingBuffer<PerfEvent>.CreateSingleProducer(PerfEvent.EventFactory, _bufferSize, new YieldingWaitStrategy());
        _ringBuffer = RingBuffer <PerfEvent> .CreateSingleProducer(PerfEvent.EventFactory, _bufferSize, new AsyncWaitStrategy());

        var sequenceBarrier = _ringBuffer.NewAsyncBarrier();

        _eventProcessor = EventProcessorFactory.Create(_ringBuffer, sequenceBarrier, _eventHandler);
        _ringBuffer.AddGatingSequences(_eventProcessor.Sequence);
    }
예제 #2
0
        public AsyncEventQueueDispatchListenerTests()
        {
            asyncEventQueueDispatcher = Substitute.For <IAsyncEventQueueDispatcher>();
            asyncEventProcessor       = Substitute.For <IAsyncEventProcessor>();

            sut = new AsyncEventQueueDispatchListener(asyncEventQueueDispatcher, asyncEventProcessor);

            messages = new List <IEventMessage <IEvent> >()
            {
                new EventMessage <Event1>(new Event1(), new Dictionary <string, string>()),
                new EventMessage <Event1>(new Event1(), new Dictionary <string, string>())
            };

            unitOfWork = Substitute.For <IUnitOfWork>();
        }
    public PingPongSequencedLatencyTest_AsyncBatchHandler()
    {
        var pingBuffer = RingBuffer <PingPongEvent> .CreateSingleProducer(() => new PingPongEvent(), _bufferSize, new AsyncWaitStrategy());

        var pongBuffer = RingBuffer <PingPongEvent> .CreateSingleProducer(() => new PingPongEvent(), _bufferSize, new AsyncWaitStrategy());

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

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

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

        pingBuffer.AddGatingSequences(_pingProcessor.Sequence);
        pongBuffer.AddGatingSequences(_pongProcessor.Sequence);
    }
예제 #4
0
 public AsyncEventQueueDispatchListener(IAsyncEventQueueDispatcher asyncEventQueueDispatcher,
                                        IAsyncEventProcessor asyncEventProcessor)
 {
     this.asyncEventQueueDispatcher = asyncEventQueueDispatcher;
     this.asyncEventProcessor       = asyncEventProcessor;
 }