public bool HeartBeat() { if (_aggregator.Error != null) { throw _aggregator.Error; } _errorHandler.Assert(); // ReplayScheduler stops threads when IDataReader rans out of replay items. return(_threadPoolCounter.CreatedThreadCount == 0); }
public bool HeartBeat() { if (_aggregator.Error != null) { throw _aggregator.Error; } _errorHandler.Assert(); _threading.HeartBeat(_pool, _state); _speed.HeartBeat(_state); return(_limit.StopTest(_state)); }
public virtual ITestState Start() { _threadPoolCounter = new ThreadPoolCounter(); _globalCounters = GlobalCounters.CreateDefault(); ITestState testState = new TestState(_timer, _globalCounters, _threadPoolCounter); PipeFactory <IResult> pipeFactory = new PipeFactory <IResult>(); _aggregator = new PipelineDataAggregator(_settings.Aggregators, pipeFactory); _aggregator.Start(); _errorHandler = new ErrorHandler(); _dataReader = _settings.DataReader; _dataReader.Begin(testState); IIterationContextFactory iterationContextFactory = CreateIterationContextFactory(); IReplayScenarioHandlerFactory scenarioHandlerFactory = CreateScenarioHandlerFactory(); IReplaySchedulerFactory schedulerFactory = CreateSchedulerFactory(); IDataCollectorFactory dataCollectorFactory = CreateDataCollectorFactory(pipeFactory, _threadPoolCounter); IScenarioThreadFactory scenarioThreadFactory = CreateScenarioThreadFactory(); IThreadFactory threadFactory = new ReplayScenarioThreadFactory( iterationContextFactory, scenarioHandlerFactory, schedulerFactory, dataCollectorFactory, scenarioThreadFactory ); _pool = new ThreadPool(threadFactory, _threadPoolCounter); _pool.StartWorkersAsync(_settings.ThreadCount); while (_threadPoolCounter.CreatedThreadCount != _threadPoolCounter.InitializedThreadCount) { Thread.Sleep(100); _errorHandler.Assert(); } _timer.Start(); // This line also releases Worker-Threads from wait in IPrewait return(testState); }