Пример #1
0
        private async Task GenerateGlobalBatchLatencyChart()
        {
            // Breaks the method into an async method so it can work in peace and be awaited.
            await Task.Delay(1).ConfigureAwait(false);

            var data =
                Data.ReaderStatsBySecond.
                ToList().
                OrderBy(x => x.Key).
                Select(x => new
            {
                AvgPoint = new DataPoint(x.Key, x.Average(z => z.BatchDuration)),
                MaxPoint = new DataPoint(x.Key, x.Max(z => z.BatchDuration)),
            }).
                ToList();

            LineSeries maxSeries = new LineSeries {
                Title = "Maximum", Color = OxyColors.Firebrick,
            };
            LineSeries avgSeries = new LineSeries {
                Title = "Average",
            };

            maxSeries.Points.AddRange(data.Select(x => x.MaxPoint));
            avgSeries.Points.AddRange(data.Select(x => x.AvgPoint));

            lock (GlobalBatchLatencyPlot.SyncRoot)
            {
                GlobalBatchLatencyPlot.Series.Clear();
                GlobalBatchLatencyPlot.Series.Add(maxSeries);
                GlobalBatchLatencyPlot.Series.Add(avgSeries);
            }

            GlobalBatchLatencyPlot.InvalidatePlot(true);
        }
Пример #2
0
 private void ResetGlobalBatchLatencyPlotButton_ClickHandler(object sender, RoutedEventArgs e)
 {
     GlobalBatchLatencyPlot.ResetAllAxes();
 }