Esempio n. 1
0
        public async Task GetVersionAsync()
        {
            _perfService
            .Initialize(perfName, new PerformanceServiceSetting
            {
                AutoLogging = true,
                StatInitializeDelaySeconds = 1,
                StatIntervalSeconds        = 1,
                PerformanceInfoHandler     = (metrics) =>
                {
                    if (metrics.TotalCount == _parallelService.Throughput)
                    {
                        var perfInfo = _httpPerfService.GetPerformanceInfoString();
                        _logger.Info(perfInfo);
                        _perfService.Stop();
                    }
                }
            })
            .Start();

            await _parallelService.DispatchAsync(async() =>
            {
                var start = DateTime.UtcNow;

                await VersionAsync();

                _perfService.IncrementKeyCount(perfKey, DateTime.UtcNow.Subtract(start).TotalMilliseconds);
            });
        }