public Pipeline3StepLatencyPerfTest() { InitHistogram(); InitStopwatchTimeCostNs(); ringBuffer = new RingBuffer <ValueEntry>(new ValueEntryFactory(), SIZE, new SingleThreadedStrategy(), new BusySpinStrategy <ValueEntry>()); stepOneConsumerBarrier = ringBuffer.CreateConsumerBarrier(); stepOneFunctionHandler = new LatencyStepHandler(FunctionStep.ONE, _histogram, _stopwatchTimeCostNs, _stopwatch); stepOneBatchConsumer = new BatchConsumer <ValueEntry>(stepOneConsumerBarrier, stepOneFunctionHandler); stepTwoConsumerBarrier = ringBuffer.CreateConsumerBarrier(stepOneBatchConsumer); stepTwoFunctionHandler = new LatencyStepHandler(FunctionStep.TWO, _histogram, _stopwatchTimeCostNs, _stopwatch); stepTwoBatchConsumer = new BatchConsumer <ValueEntry>(stepTwoConsumerBarrier, stepTwoFunctionHandler); stepThreeConsumerBarrier = ringBuffer.CreateConsumerBarrier(stepTwoBatchConsumer); stepThreeFunctionHandler = new LatencyStepHandler(FunctionStep.THREE, _histogram, _stopwatchTimeCostNs, _stopwatch); stepThreeBatchConsumer = new BatchConsumer <ValueEntry>(stepThreeConsumerBarrier, stepThreeFunctionHandler); producerBarrier = ringBuffer.CreateProducerBarrier(stepThreeBatchConsumer); stepOneQueue = new BlockingCollection <long>(SIZE); stepTwoQueue = new BlockingCollection <long>(SIZE); stepThreeQueue = new BlockingCollection <long>(SIZE); stepOneQueueConsumer = new LatencyStepQueueConsumer( FunctionStep.ONE, stepOneQueue, stepTwoQueue, _histogram, _stopwatchTimeCostNs, _stopwatch); stepTwoQueueConsumer = new LatencyStepQueueConsumer( FunctionStep.TWO, stepTwoQueue, stepThreeQueue, _histogram, _stopwatchTimeCostNs, _stopwatch); stepThreeQueueConsumer = new LatencyStepQueueConsumer( FunctionStep.THREE, stepThreeQueue, null, _histogram, _stopwatchTimeCostNs, _stopwatch); }
public Pipeline3StepLatencyPerfTest() { InitHistogram(); InitStopwatchTimeCostNs(); ringBuffer = new RingBuffer<ValueEntry>(new ValueEntryFactory(), SIZE, new SingleThreadedStrategy(), new BusySpinStrategy<ValueEntry>()); stepOneConsumerBarrier = ringBuffer.CreateConsumerBarrier(); stepOneFunctionHandler = new LatencyStepHandler(FunctionStep.ONE, _histogram, _stopwatchTimeCostNs, _stopwatch); stepOneBatchConsumer = new BatchConsumer<ValueEntry>(stepOneConsumerBarrier, stepOneFunctionHandler); stepTwoConsumerBarrier = ringBuffer.CreateConsumerBarrier(stepOneBatchConsumer); stepTwoFunctionHandler = new LatencyStepHandler(FunctionStep.TWO, _histogram, _stopwatchTimeCostNs, _stopwatch); stepTwoBatchConsumer = new BatchConsumer<ValueEntry>(stepTwoConsumerBarrier, stepTwoFunctionHandler); stepThreeConsumerBarrier = ringBuffer.CreateConsumerBarrier(stepTwoBatchConsumer); stepThreeFunctionHandler = new LatencyStepHandler(FunctionStep.THREE, _histogram, _stopwatchTimeCostNs, _stopwatch); stepThreeBatchConsumer = new BatchConsumer<ValueEntry>(stepThreeConsumerBarrier, stepThreeFunctionHandler); producerBarrier = ringBuffer.CreateProducerBarrier(stepThreeBatchConsumer); stepOneQueue = new BlockingCollection<long>(SIZE); stepTwoQueue = new BlockingCollection<long>(SIZE); stepThreeQueue = new BlockingCollection<long>(SIZE); stepOneQueueConsumer = new LatencyStepQueueConsumer( FunctionStep.ONE, stepOneQueue, stepTwoQueue, _histogram, _stopwatchTimeCostNs, _stopwatch); stepTwoQueueConsumer = new LatencyStepQueueConsumer( FunctionStep.TWO, stepTwoQueue, stepThreeQueue, _histogram, _stopwatchTimeCostNs, _stopwatch); stepThreeQueueConsumer = new LatencyStepQueueConsumer( FunctionStep.THREE, stepThreeQueue, null, _histogram, _stopwatchTimeCostNs, _stopwatch); }