private void GetChildrenPerformanceTest(IRingMasterRequestHandler ringMaster, ConfigurationSection config, CancellationToken cancellationToken) { string testPath = config.GetStringValue("TestPath"); int maxChildren = config.GetIntValue("MaxChildren"); int maxConcurrentRequests = config.GetIntValue("MaxConcurrentRequests"); var instrumentation = new GetChildrenPerformanceInstrumentation(this.MetricsFactory); var getChildrenPerformanceTest = new GetChildrenPerformance(instrumentation, maxConcurrentRequests, cancellationToken); EnumerationStressServiceEventSource.Log.GetChildrenPerformanceTestStarted(testPath, maxChildren, maxConcurrentRequests); getChildrenPerformanceTest.QueueRequests(ringMaster, testPath, maxChildren); }
private void GetChildrenPerformanceTest(IRingMasterRequestHandler ringMaster, int maxChildren) { var instrumentation = new GetChildrenPerformanceInstrumentation(); var getChildrenPerformanceTest = new GetChildrenPerformance(instrumentation, this.MaxConcurrency, CancellationToken.None); Trace.TraceInformation($"GetChildren performance test path={this.TestPath}, maxChildren={maxChildren}"); var task = Task.Run(() => getChildrenPerformanceTest.QueueRequests(ringMaster, this.TestPath, maxChildren)); long lastSuccessCount = 0; var timer = Stopwatch.StartNew(); while (!task.Wait(5000)) { timer.Stop(); long rate = (long)((instrumentation.Success - lastSuccessCount) * 1000) / timer.ElapsedMilliseconds; Trace.TraceInformation($"GetChildren success={instrumentation.Success}, failure={instrumentation.Failure}, rate={rate}"); timer.Restart(); lastSuccessCount = instrumentation.Success; } }