Ejemplo n.º 1
0
        public async Task Load(WorkerResult workerResult, ResultWindowItem baselineResult)
        {
            var taskResult = await GenerateAsync(workerResult);

            _resultWindowItem = taskResult.ResultWindowItem;

            RequestsPerSecondGraph.Draw(taskResult.Throughput, "{Y:#,0} rps");
            var dataPoints = workerResult.Histogram.Select((count, i) => new DataPoint(i / 80.0 * (_resultWindowItem.Max - _resultWindowItem.Min) + _resultWindowItem.Min, count)).ToList();

            HistogramGraph.Draw(dataPoints, "{X:0.000} ms");

            Title = "Netling - " + _resultWindowItem.Name;
            ThreadsValueUserControl.Value = _resultWindowItem.Threads.ToString();

            RequestsValueUserControl.Value  = _resultWindowItem.JobsPerSecond.ToString("#,0");
            ElapsedValueUserControl.Value   = $"{_resultWindowItem.ElapsedSeconds:0}";
            BandwidthValueUserControl.Value = _resultWindowItem.Bandwidth.ToString("#,0");
            ErrorsValueUserControl.Value    = _resultWindowItem.Errors.ToString("#,0");
            MedianValueUserControl.Value    = string.Format(_resultWindowItem.Median > 5 ? "{0:#,0}" : "{0:0.000}", _resultWindowItem.Median);
            StdDevValueUserControl.Value    = string.Format(_resultWindowItem.StdDev > 5 ? "{0:#,0}" : "{0:0.000}", _resultWindowItem.StdDev);
            MinValueUserControl.Value       = string.Format(_resultWindowItem.Min > 5 ? "{0:#,0}" : "{0:0.000}", _resultWindowItem.Min);
            MaxValueUserControl.Value       = string.Format(_resultWindowItem.Max > 5 ? "{0:#,0}" : "{0:0.000}", _resultWindowItem.Max);
            MinTextBlock.Text = MinValueUserControl.Value + " ms";
            MaxTextBlock.Text = MaxValueUserControl.Value + " ms";

            if (workerResult.StatusCodes.Any(s => s.Key != 200))
            {
                StatusCodesTab.Visibility      = Visibility.Visible;
                StatusCodesListBox.ItemsSource = workerResult.StatusCodes
                                                 .Select(s => new
                {
                    Name  = $"{s.Key} - {(s.Key > 0 ? ((System.Net.HttpStatusCode)s.Key).ToString() : "")}",
                    Count = s.Value
                })
                                                 .ToList();

                if (!workerResult.Exceptions.Any())
                {
                    StatusCodesTab.Focus();
                }
            }

            if (workerResult.Exceptions.Any())
            {
                ExceptionsTab.Visibility = Visibility.Visible;
                ExceptionsTextBox.Text   = string.Join("\r\n\r\n----\r\n\r\n", workerResult.Exceptions.Select(e => e.ToString()));
                ExceptionsTab.Focus();
            }

            if (baselineResult != null)
            {
                LoadBaseline(baselineResult);
            }
        }
Ejemplo n.º 2
0
        public async Task Load(WorkerResult workerResult)
        {
            var taskResult = await GenerateAsync(workerResult);

            _resultWindowItem = taskResult.ResultWindowItem;

            RequestsPerSecondGraph.Draw(taskResult.Throughput, "{Y:#,0} rps");
            var dataPoints = workerResult.Histogram.Select((count, i) => new DataPoint(i / 80.0 * (_resultWindowItem.Max - _resultWindowItem.Min) + _resultWindowItem.Min, count)).ToList();

            HistogramGraph.Draw(dataPoints, "{X:0.000} ms");

            Title = "Netling - " + _resultWindowItem.Url;
            ThreadsValueUserControl.Value        = _resultWindowItem.Threads.ToString();
            PipeliningValueUserControl.Value     = _resultWindowItem.Pipelining.ToString();
            ThreadAffinityValueUserControl.Value = _resultWindowItem.ThreadAffinity ? "ON" : "OFF";

            RequestsValueUserControl.Value  = _resultWindowItem.JobsPerSecond.ToString("#,0");
            ElapsedValueUserControl.Value   = $"{_resultWindowItem.ElapsedSeconds:0}";
            BandwidthValueUserControl.Value = _resultWindowItem.Bandwidth.ToString("#,0");
            ErrorsValueUserControl.Value    = _resultWindowItem.Errors.ToString("#,0");
            MedianValueUserControl.Value    = string.Format(_resultWindowItem.Median > 5 ? "{0:#,0}" : "{0:0.000}", _resultWindowItem.Median);
            StdDevValueUserControl.Value    = string.Format(_resultWindowItem.StdDev > 5 ? "{0:#,0}" : "{0:0.000}", _resultWindowItem.StdDev);
            MinValueUserControl.Value       = string.Format(_resultWindowItem.Min > 5 ? "{0:#,0}" : "{0:0.000}", _resultWindowItem.Min);
            MaxValueUserControl.Value       = string.Format(_resultWindowItem.Max > 5 ? "{0:#,0}" : "{0:0.000}", _resultWindowItem.Max);
            MinTextBlock.Text = MinValueUserControl.Value + " ms";
            MaxTextBlock.Text = MaxValueUserControl.Value + " ms";

            var errors = new Dictionary <string, string>();

            foreach (var statusCode in workerResult.StatusCodes)
            {
                errors.Add(statusCode.Key.ToString(), statusCode.Value.ToString("#,0"));
            }

            foreach (var exception in workerResult.Exceptions)
            {
                errors.Add(exception.Key.ToString(), exception.Value.ToString("#,0"));
            }

            ErrorsListView.ItemsSource = errors;

            if (_sender.ResultWindowItem != null)
            {
                LoadBaseline(_sender.ResultWindowItem);
            }
        }