public void RemoveFunctionListener(FunctionEventHandler pHandler, params string[] pFunctionNames) { foreach (string s in pFunctionNames) { RemoveFunctionListener(pHandler, s); } }
public OneToThreePipelineSequencedThroughputTest() { var stepOneFunctionHandler = new FunctionEventHandler(FunctionStep.One); var stepTwoFunctionHandler = new FunctionEventHandler(FunctionStep.Two); _stepThreeFunctionHandler = new FunctionEventHandler(FunctionStep.Three); var stepOneSequenceBarrier = _ringBuffer.NewBarrier(); _stepOneBatchProcessor = new BatchEventProcessor<FunctionEvent>(_ringBuffer, stepOneSequenceBarrier, stepOneFunctionHandler); var stepTwoSequenceBarrier = _ringBuffer.NewBarrier(_stepOneBatchProcessor.Sequence); _stepTwoBatchProcessor = new BatchEventProcessor<FunctionEvent>(_ringBuffer, stepTwoSequenceBarrier, stepTwoFunctionHandler); var stepThreeSequenceBarrier = _ringBuffer.NewBarrier(_stepTwoBatchProcessor.Sequence); _stepThreeBatchProcessor = new BatchEventProcessor<FunctionEvent>(_ringBuffer, stepThreeSequenceBarrier, _stepThreeFunctionHandler); var temp = 0L; var operandTwo = _operandTwoInitialValue; for (long i = 0; i < _iterations; i++) { var stepOneResult = i + operandTwo--; var stepTwoResult = stepOneResult + 3; if ((stepTwoResult & 4L) == 4L) { ++temp; } } _expectedResult = temp; _ringBuffer.AddGatingSequences(_stepThreeBatchProcessor.Sequence); }
public void AddFunctionListener(FunctionEventHandler pHandler, string pFunctionName) { if (!_functionHandlers.ContainsKey(pFunctionName)) { _functionHandlers.Add(pFunctionName, new List <FunctionEventHandler>()); } _functionHandlers[pFunctionName].Add(pHandler); }
public Pipeline3StepDisruptorPerfTest() : base(100 * Million) { _disruptor = new Disruptor <FunctionEvent>(() => new FunctionEvent(), Size, TaskScheduler.Default, ProducerType.SINGLE, new YieldingWaitStrategy());; _mru = new ManualResetEvent(false); _stepThreeFunctionEventHandler = new FunctionEventHandler(FunctionStep.Three, Iterations, _mru); _disruptor.HandleEventsWith(new FunctionEventHandler(FunctionStep.One, Iterations, _mru)) .Then(new FunctionEventHandler(FunctionStep.Two, Iterations, _mru)) .Then(_stepThreeFunctionEventHandler); _ringBuffer = _disruptor.GetRingBuffer; }
public Pipeline3StepDisruptorPerfTest() : base(100 * Million) { _disruptor = new Disruptor<FunctionEvent>(() => new FunctionEvent(), Size, TaskScheduler.Default, ProducerType.SINGLE, new YieldingWaitStrategy()); ; _mru = new ManualResetEvent(false); _stepThreeFunctionEventHandler = new FunctionEventHandler(FunctionStep.Three, Iterations, _mru); _disruptor.HandleEventsWith(new FunctionEventHandler(FunctionStep.One, Iterations, _mru)) .Then(new FunctionEventHandler(FunctionStep.Two, Iterations, _mru)) .Then(_stepThreeFunctionEventHandler); _ringBuffer = _disruptor.GetRingBuffer; }
public Pipeline3StepDisruptorWithAffinityPerfTest() : base(100 * Million)//1千万 1亿 { _scheduler = new RoundRobinThreadAffinedTaskScheduler(4); _disruptor = new Disruptor<FunctionEvent>(() => new FunctionEvent(),Size,_scheduler, ProducerType.SINGLE,new YieldingWaitStrategy()); _mru = new ManualResetEvent(false); _stepThreeFunctionEventHandler = new FunctionEventHandler(FunctionStep.Three, Iterations, _mru); _disruptor.HandleEventsWith(new FunctionEventHandler(FunctionStep.One, Iterations, _mru)) .Then(new FunctionEventHandler(FunctionStep.Two, Iterations, _mru)) .Then(_stepThreeFunctionEventHandler); _ringBuffer = _disruptor.GetRingBuffer; }
public Pipeline3StepDisruptorWithAffinityPerfTest() : base(100 * Million)//1千万 1亿 { _scheduler = new RoundRobinThreadAffinedTaskScheduler(4); _disruptor = new Disruptor <FunctionEvent>(() => new FunctionEvent(), Size, _scheduler, ProducerType.SINGLE, new YieldingWaitStrategy()); _mru = new ManualResetEvent(false); _stepThreeFunctionEventHandler = new FunctionEventHandler(FunctionStep.Three, Iterations, _mru); _disruptor.HandleEventsWith(new FunctionEventHandler(FunctionStep.One, Iterations, _mru)) .Then(new FunctionEventHandler(FunctionStep.Two, Iterations, _mru)) .Then(_stepThreeFunctionEventHandler); _ringBuffer = _disruptor.GetRingBuffer; }
public Pipeline3StepDisruptorPerfTest() : base(100 * Million) { _disruptor = new Disruptor <FunctionEvent>(() => new FunctionEvent(), new SingleThreadedClaimStrategy(Size), new YieldingWaitStrategy()); _mru = new ManualResetEvent(false); _stepThreeFunctionEventHandler = new FunctionEventHandler(FunctionStep.Three, Iterations, _mru); _disruptor.HandleEventsWith(new FunctionEventHandler(FunctionStep.One, Iterations, _mru)) .Then(new FunctionEventHandler(FunctionStep.Two, Iterations, _mru)) .Then(_stepThreeFunctionEventHandler); _ringBuffer = _disruptor.RingBuffer; }
public Pipeline3StepDisruptorPerfTest() : base(100 * Million) { _disruptor = new Disruptor<FunctionEvent>(() => new FunctionEvent(), new SingleThreadedClaimStrategy(Size), new YieldingWaitStrategy()); _mru = new ManualResetEvent(false); _stepThreeFunctionEventHandler = new FunctionEventHandler(FunctionStep.Three, Iterations, _mru); _disruptor.HandleEventsWith(new FunctionEventHandler(FunctionStep.One, Iterations, _mru)) .Then(new FunctionEventHandler(FunctionStep.Two, Iterations, _mru)) .Then(_stepThreeFunctionEventHandler); _ringBuffer = _disruptor.RingBuffer; }
public OneToThreePipelineSequencedThroughputTest() { var stepOneFunctionHandler = new FunctionEventHandler(FunctionStep.One); var stepTwoFunctionHandler = new FunctionEventHandler(FunctionStep.Two); _stepThreeFunctionHandler = new FunctionEventHandler(FunctionStep.Three); var stepOneSequenceBarrier = _ringBuffer.NewBarrier(); _stepOneBatchProcessor = new BatchEventProcessor <FunctionEvent>(_ringBuffer, stepOneSequenceBarrier, stepOneFunctionHandler); var stepTwoSequenceBarrier = _ringBuffer.NewBarrier(_stepOneBatchProcessor.Sequence); _stepTwoBatchProcessor = new BatchEventProcessor <FunctionEvent>(_ringBuffer, stepTwoSequenceBarrier, stepTwoFunctionHandler); var stepThreeSequenceBarrier = _ringBuffer.NewBarrier(_stepTwoBatchProcessor.Sequence); _stepThreeBatchProcessor = new BatchEventProcessor <FunctionEvent>(_ringBuffer, stepThreeSequenceBarrier, _stepThreeFunctionHandler); var temp = 0L; var operandTwo = _operandTwoInitialValue; for (long i = 0; i < _iterations; i++) { var stepOneResult = i + operandTwo--; var stepTwoResult = stepOneResult + 3; if ((stepTwoResult & 4L) == 4L) { ++temp; } } _expectedResult = temp; _ringBuffer.AddGatingSequences(_stepThreeBatchProcessor.Sequence); }
public void RemoveFunctionListener(FunctionEventHandler pHandler, string pFunctionName) { _functionHandlers[pFunctionName].Remove(pHandler); }
public void AddFunctionListener(FunctionEventHandler pHandler, string pFunctionName) { if (!_functionHandlers.ContainsKey(pFunctionName)) _functionHandlers.Add(pFunctionName, new List<FunctionEventHandler>()); _functionHandlers[pFunctionName].Add(pHandler); }