private string GetLabelCustomContext(ComparisonRecordInfoWrapper record, int maxAlignment) { var comment = record.WrappedRecordInfo.FileRecordInfo.Comment ?? ""; var commentParts = comment.SplitWordWise(PART_LENGTH); var alignmentFormat = "{0," + maxAlignment.ToString() + "}"; var infoPartsFormatted = string.Empty; foreach (var part in commentParts) { if (part == string.Empty) { continue; } infoPartsFormatted += string.Format(CultureInfo.InvariantCulture, alignmentFormat, part) + Environment.NewLine; } bool hasUniqueGameNames = GetHasUniqueGameNames(); if (hasUniqueGameNames) { return(infoPartsFormatted); } else { var gameName = string.Format(CultureInfo.InvariantCulture, alignmentFormat, record.WrappedRecordInfo.Game); return(gameName + Environment.NewLine + infoPartsFormatted); } }
private ComparisonRecordInfoWrapper GetWrappedRecordInfo(ComparisonRecordInfo comparisonRecordInfo) { var wrappedRecordInfo = new ComparisonRecordInfoWrapper(comparisonRecordInfo, ComparisonModel, ComparisonLShapeCollection); return(wrappedRecordInfo); }
private void AddToLShapeChart(ComparisonRecordInfoWrapper wrappedComparisonInfo) { double startTime = FirstSeconds; double endTime = LastSeconds; var frametimeTimeWindow = wrappedComparisonInfo.WrappedRecordInfo.Session.GetFrametimeTimeWindow(startTime, endTime, _appConfiguration, ERemoveOutlierMethod.None); var lShapeQuantiles = _frametimeAnalyzer.GetLShapeQuantiles(); double action(double q) => _frametimeStatisticProvider.GetPQuantileSequence(frametimeTimeWindow, q / 100); var quantiles = lShapeQuantiles.Select(q => new ObservablePoint(q, action(q))); var quantileValues = new ChartValues <ObservablePoint>(); quantileValues.AddRange(quantiles); ComparisonLShapeCollection.Add( new LineSeries { Id = wrappedComparisonInfo.WrappedRecordInfo.FileRecordInfo.Id, Values = quantileValues, Stroke = wrappedComparisonInfo.IsHideModeSelected ? Brushes.Transparent : wrappedComparisonInfo.Color, Fill = Brushes.Transparent, StrokeThickness = 1, LineSmoothness = 1, PointGeometrySize = 5, PointGeometry = DefaultGeometries.Square, PointForeground = wrappedComparisonInfo.IsHideModeSelected ? Brushes.Transparent : wrappedComparisonInfo.Color, LabelPoint = chartPoint => string.Format(CultureInfo.InvariantCulture, "{0:0.##}", chartPoint.Y, "ms") }); }
private void AddToLShapeChart(ComparisonRecordInfoWrapper wrappedComparisonInfo) { double startTime = FirstSeconds; double endTime = _maxRecordingTime - LastSeconds; var frametimeTimeWindow = wrappedComparisonInfo.WrappedRecordInfo.Session.GetFrametimeTimeWindow(startTime, endTime, ERemoveOutlierMethod.None); var lShapeQuantiles = _frametimeAnalyzer.GetLShapeQuantiles(); double action(double q) => _frametimeStatisticProvider.GetPQuantileSequence(frametimeTimeWindow, q / 100); var quantiles = lShapeQuantiles.Select(q => new ObservablePoint(q, action(q))); var quantileValues = new ChartValues <ObservablePoint>(); quantileValues.AddRange(quantiles); Application.Current.Dispatcher.BeginInvoke(new Action(() => { ComparisonLShapeCollection.Add( new LineSeries { Values = quantileValues, Stroke = wrappedComparisonInfo.Color, Fill = Brushes.Transparent, StrokeThickness = 1, LineSmoothness = 1, PointGeometrySize = 10, PointGeometry = DefaultGeometries.Triangle, }); })); }
private void InsertComparisonRecordsSorted(ComparisonRecordInfoWrapper wrappedComparisonRecordInfo) { if (!ComparisonRecords.Any()) { ComparisonRecords.Add(wrappedComparisonRecordInfo); return; } var list = new List <ComparisonRecordInfoWrapper>(ComparisonRecords) { wrappedComparisonRecordInfo }; List <ComparisonRecordInfoWrapper> orderedList = null; if (UseComparisonGrouping) { orderedList = IsSortModeAscending ? list.OrderBy(x => x.WrappedRecordInfo.Game).ThenBy(x => x.WrappedRecordInfo.FirstMetric).ToList() : list.OrderBy(x => x.WrappedRecordInfo.Game).ThenByDescending(x => x.WrappedRecordInfo.FirstMetric).ToList(); } else { orderedList = IsSortModeAscending ? list.OrderBy(x => x.WrappedRecordInfo.FirstMetric).ToList() : list.OrderByDescending(x => x.WrappedRecordInfo.FirstMetric).ToList(); } if (orderedList != null) { var index = orderedList.IndexOf(wrappedComparisonRecordInfo); ComparisonRecords.Insert(index, wrappedComparisonRecordInfo); } }
private void AddToCharts(ComparisonRecordInfoWrapper wrappedComparisonInfo) { AddToFrameTimeChart(wrappedComparisonInfo); AddToColumnCharts(wrappedComparisonInfo); AddToLShapeChart(wrappedComparisonInfo); UpdateAxesMinMax(true); }
private void AddToFrameTimeChart(ComparisonRecordInfoWrapper wrappedComparisonInfo) { double startTime = FirstSeconds; double endTime = LastSeconds; var session = wrappedComparisonInfo.WrappedRecordInfo.Session; var frametimePoints = session.GetFrametimePointsTimeWindow(startTime, endTime) .Select(pnt => new Point(pnt.X, pnt.Y)); var chartTitle = string.Empty; if (IsContextLegendActive) { switch (SelectedComparisonContext) { case EComparisonContext.DateTime: chartTitle = $"{wrappedComparisonInfo.WrappedRecordInfo.FileRecordInfo.CreationDate} " + $"{ wrappedComparisonInfo.WrappedRecordInfo.FileRecordInfo.CreationTime}"; break; case EComparisonContext.CPU: chartTitle = wrappedComparisonInfo.WrappedRecordInfo.FileRecordInfo.ProcessorName; break; case EComparisonContext.GPU: chartTitle = wrappedComparisonInfo.WrappedRecordInfo.FileRecordInfo.GraphicCardName; break; case EComparisonContext.SystemRam: chartTitle = wrappedComparisonInfo.WrappedRecordInfo.FileRecordInfo.SystemRamInfo; break; case EComparisonContext.Custom: chartTitle = wrappedComparisonInfo.WrappedRecordInfo.FileRecordInfo.Comment; break; default: chartTitle = $"{wrappedComparisonInfo.WrappedRecordInfo.FileRecordInfo.CreationDate} " + $"{ wrappedComparisonInfo.WrappedRecordInfo.FileRecordInfo.CreationTime}"; break; } } var color = wrappedComparisonInfo.FrametimeGraphColor.Value; var frametimeSeries = new OxyPlot.Series.LineSeries { Id = wrappedComparisonInfo.WrappedRecordInfo.FileRecordInfo.Id, Title = chartTitle, StrokeThickness = 1, LegendStrokeThickness = 4, Color = wrappedComparisonInfo.IsHideModeSelected ? OxyColors.Transparent : OxyColor.FromRgb(color.R, color.G, color.B) }; frametimeSeries.Points.AddRange(frametimePoints.Select(pnt => new DataPoint(pnt.X, pnt.Y))); ComparisonModel.Series.Add(frametimeSeries); }
private ComparisonRecordInfoWrapper GetWrappedRecordInfo(ComparisonRecordInfo comparisonRecordInfo) { var wrappedComparisonRecordInfo = new ComparisonRecordInfoWrapper(comparisonRecordInfo, this); var color = _comparisonColorManager.GetNextFreeColor(); wrappedComparisonRecordInfo.Color = color; wrappedComparisonRecordInfo.FrametimeGraphColor = color.Color; return(wrappedComparisonRecordInfo); }
private string GetLabelDateTimeContext(ComparisonRecordInfoWrapper record) { int gameNameLength = record.WrappedRecordInfo.Game.Length; int dateTimeLength = record.WrappedRecordInfo.DateTime.Length; int maxAlignment = gameNameLength < dateTimeLength ? dateTimeLength : gameNameLength; var alignmentFormat = "{0," + maxAlignment.ToString() + "}"; var gameName = string.Format(CultureInfo.InvariantCulture, alignmentFormat, record.WrappedRecordInfo.Game); var dateTime = string.Format(CultureInfo.InvariantCulture, alignmentFormat, record.WrappedRecordInfo.DateTime); return(gameName + Environment.NewLine + dateTime); }
private string GetLabelCpuContext(ComparisonRecordInfoWrapper record) { var processorName = record.WrappedRecordInfo.FileRecordInfo.ProcessorName ?? ""; int gameNameLength = record.WrappedRecordInfo.Game.Length; int cpuInfoLength = processorName.Length; int maxAlignment = gameNameLength < cpuInfoLength ? cpuInfoLength : gameNameLength; var alignmentFormat = "{0," + maxAlignment.ToString() + "}"; var gameName = string.Format(CultureInfo.InvariantCulture, alignmentFormat, record.WrappedRecordInfo.Game); var cpuInfo = string.Format(CultureInfo.InvariantCulture, alignmentFormat, processorName); return(gameName + Environment.NewLine + cpuInfo); }
private string GetLabelCustomContext(ComparisonRecordInfoWrapper record) { var comment = record.WrappedRecordInfo.FileRecordInfo.Comment ?? ""; int gameNameLength = record.WrappedRecordInfo.Game.Length; int commentLength = comment.Length; int maxAlignment = gameNameLength < commentLength ? commentLength : gameNameLength; var alignmentFormat = "{0," + maxAlignment.ToString() + "}"; var gameName = string.Format(CultureInfo.InvariantCulture, alignmentFormat, record.WrappedRecordInfo.Game); var gpuInfo = string.Format(CultureInfo.InvariantCulture, alignmentFormat, comment); return(gameName + Environment.NewLine + gpuInfo); }
private string GetLabelGpuContext(ComparisonRecordInfoWrapper record) { var graphicCardName = record.WrappedRecordInfo.FileRecordInfo.GraphicCardName ?? ""; int gameNameLength = record.WrappedRecordInfo.Game.Length; int gpuInfoLength = graphicCardName.Length; int maxAlignment = gameNameLength < gpuInfoLength ? gpuInfoLength : gameNameLength; var alignmentFormat = "{0," + maxAlignment.ToString() + "}"; var gameName = string.Format(CultureInfo.InvariantCulture, alignmentFormat, record.WrappedRecordInfo.Game); var gpuInfo = string.Format(CultureInfo.InvariantCulture, alignmentFormat, graphicCardName); return(gameName + Environment.NewLine + gpuInfo); }
private void AddToColumnCharts(ComparisonRecordInfoWrapper wrappedComparisonInfo) { // Update metrics SetMetrics(wrappedComparisonInfo); // First metric ComparisonRowChartSeriesCollection[0].Values.Insert(0, wrappedComparisonInfo.WrappedRecordInfo.FirstMetric); // Second metric if (ComparisonRowChartSeriesCollection.Count > 1) { ComparisonRowChartSeriesCollection[1].Values.Insert(0, wrappedComparisonInfo.WrappedRecordInfo.SecondMetric); } // Second metric if (ComparisonRowChartSeriesCollection.Count > 2) { ComparisonRowChartSeriesCollection[2].Values.Insert(0, wrappedComparisonInfo.WrappedRecordInfo.ThirdMetric); } SetBarMaxValue(); switch (SelectedComparisonContext) { case EComparisonContext.DateTime: SetLabelDateTimeContext(); break; case EComparisonContext.CPU: SetLabelCpuContext(); break; case EComparisonContext.GPU: SetLabelGpuContext(); break; case EComparisonContext.SystemRam: SetLabelSystemRamContext(); break; case EComparisonContext.Custom: SetLabelCustomContext(); break; default: SetLabelDateTimeContext(); break; } }
private string GetLabelDateTimeContext(ComparisonRecordInfoWrapper record, int maxAlignment) { var alignmentFormat = "{0," + maxAlignment.ToString() + "}"; bool hasUniqueGameNames = GetHasUniqueGameNames(); if (hasUniqueGameNames) { return(string.Format(CultureInfo.InvariantCulture, alignmentFormat, $"{record.WrappedRecordInfo.FileRecordInfo.CreationDate} { record.WrappedRecordInfo.FileRecordInfo.CreationTime}")); } else { var gameName = string.Format(CultureInfo.InvariantCulture, alignmentFormat, record.WrappedRecordInfo.Game); var dateTime = string.Format(CultureInfo.InvariantCulture, alignmentFormat, record.WrappedRecordInfo.DateTime); return(gameName + Environment.NewLine + dateTime); } }
private void AddToColumnCharts(ComparisonRecordInfoWrapper wrappedComparisonInfo) { double startTime = FirstSeconds; double endTime = _maxRecordingTime - LastSeconds; var frametimeTimeWindow = wrappedComparisonInfo.WrappedRecordInfo.Session.GetFrametimeTimeWindow(startTime, endTime, ERemoveOutlierMethod.None); var roundingDigits = _appConfiguration.FpsValuesRoundingDigits; var fps = frametimeTimeWindow.Select(ft => 1000 / ft).ToList(); var average = Math.Round(frametimeTimeWindow.Count * 1000 / frametimeTimeWindow.Sum(), roundingDigits); var p1_quantile = Math.Round(_frametimeStatisticProvider.GetPQuantileSequence(fps, 0.01), roundingDigits); var p0dot1_quantile = Math.Round(_frametimeStatisticProvider.GetPQuantileSequence(fps, 0.001), roundingDigits); // Average ComparisonColumnChartSeriesCollection[0].Values.Add(average); //1% quantile ComparisonColumnChartSeriesCollection[1].Values.Add(p1_quantile); //0.1% quantile ComparisonColumnChartSeriesCollection[2].Values.Add(p0dot1_quantile); switch (_comparisonContext) { case EComparisonContext.DateTime: SetLabelDateTimeContext(); break; case EComparisonContext.CPU: SetLabelCpuContext(); break; case EComparisonContext.GPU: SetLabelGpuContext(); break; case EComparisonContext.Custom: SetLabelCustomContext(); break; default: SetLabelDateTimeContext(); break; } }
public void RemoveComparisonItem(ComparisonRecordInfoWrapper wrappedComparisonRecordInfo) { _comparisonColorManager.FreeColor(wrappedComparisonRecordInfo.Color); ComparisonRecords.Remove(wrappedComparisonRecordInfo); HasComparisonItems = ComparisonRecords.Any(); UpdateRangeSliderParameter(); UpdateCharts(); UpdateBarChartHeight(); // Manage game name header HasUniqueGameNames = GetHasUniqueGameNames(); if (HasUniqueGameNames) { CurrentGameName = ComparisonRecords.First().WrappedRecordInfo.Game; } ComparisonFrametimesModel.InvalidatePlot(true); }
private void SetMetrics(ComparisonRecordInfoWrapper wrappedComparisonRecordInfo) { double startTime = FirstSeconds; double lastFrameStart = wrappedComparisonRecordInfo.WrappedRecordInfo.Session.FrameStart.Last(); double endTime = LastSeconds > lastFrameStart ? lastFrameStart : lastFrameStart + LastSeconds; var frametimeTimeWindow = wrappedComparisonRecordInfo.WrappedRecordInfo.Session.GetFrametimeTimeWindow(startTime, endTime, ERemoveOutlierMethod.None); double GeMetricValue(IList <double> sequence, EMetric metric) => _frametimeStatisticProvider.GetFpsMetricValue(sequence, metric); wrappedComparisonRecordInfo.WrappedRecordInfo.FirstMetric = GeMetricValue(frametimeTimeWindow, EMetric.Average); wrappedComparisonRecordInfo.WrappedRecordInfo.SecondMetric = GeMetricValue(frametimeTimeWindow, SelectedSecondMetric); wrappedComparisonRecordInfo.WrappedRecordInfo.ThirdMetric = GeMetricValue(frametimeTimeWindow, SelectedThirdMetric); }
private void AddToFrameTimeChart(ComparisonRecordInfoWrapper wrappedComparisonInfo) { double startTime = FirstSeconds; double endTime = _maxRecordingTime - LastSeconds; var session = wrappedComparisonInfo.WrappedRecordInfo.Session; var frametimePoints = session.GetFrametimePointsTimeWindow(startTime, endTime) .Select(pnt => new Point(pnt.X, pnt.Y)); var chartTitle = string.Empty; switch (_comparisonContext) { case EComparisonContext.DateTime: chartTitle = GetLabelDateTimeContext(wrappedComparisonInfo); break; case EComparisonContext.CPU: chartTitle = GetLabelCpuContext(wrappedComparisonInfo); break; case EComparisonContext.GPU: chartTitle = GetLabelGpuContext(wrappedComparisonInfo); break; case EComparisonContext.Custom: chartTitle = GetLabelCustomContext(wrappedComparisonInfo); break; default: chartTitle = GetLabelDateTimeContext(wrappedComparisonInfo); break; } var color = wrappedComparisonInfo.FrametimeGraphColor.Value; var frametimeSeries = new OxyPlot.Series.LineSeries { Title = chartTitle, StrokeThickness = 1, Color = OxyColor.FromRgb(color.R, color.G, color.B) }; frametimeSeries.Points.AddRange(frametimePoints.Select(pnt => new DataPoint(pnt.X, pnt.Y))); ComparisonModel.Series.Add(frametimeSeries); }
private void AddToFrameTimeChart(ComparisonRecordInfoWrapper wrappedComparisonInfo) { double startTime = FirstSeconds; double endTime = LastSeconds; var session = wrappedComparisonInfo.WrappedRecordInfo.Session; var frametimePoints = session.GetFrametimePointsTimeWindow(startTime, endTime, _appConfiguration) .Select(pnt => new Point(pnt.X, pnt.Y)); var chartTitle = string.Empty; var color = wrappedComparisonInfo.FrametimeGraphColor.Value; var frametimeSeries = new Statistics.PlotBuilder.LineSeries() { Tag = wrappedComparisonInfo.WrappedRecordInfo.FileRecordInfo.Id, Title = chartTitle, StrokeThickness = 1, LegendStrokeThickness = 4, Color = wrappedComparisonInfo.IsHideModeSelected ? OxyColors.Transparent : OxyColor.FromRgb(color.R, color.G, color.B) }; frametimeSeries.Points.AddRange(frametimePoints.Select(pnt => new DataPoint(pnt.X, pnt.Y))); ComparisonModel.Series.Add(frametimeSeries); }
private void AddToColumnCharts(ComparisonRecordInfoWrapper wrappedComparisonInfo) { // Update metrics SetMetrics(wrappedComparisonInfo); // First metric ComparisonRowChartSeriesCollection[0].Values.Insert(0, wrappedComparisonInfo.WrappedRecordInfo.FirstMetric); // Second metric if (ComparisonRowChartSeriesCollection.Count > 1) { ComparisonRowChartSeriesCollection[1].Values.Insert(0, wrappedComparisonInfo.WrappedRecordInfo.SecondMetric); } // Second metric if (ComparisonRowChartSeriesCollection.Count > 2) { ComparisonRowChartSeriesCollection[2].Values.Insert(0, wrappedComparisonInfo.WrappedRecordInfo.ThirdMetric); } SetBarMaxValue(); OnComparisonContextChanged(); }
private void SetMetrics(ComparisonRecordInfoWrapper wrappedComparisonRecordInfo) { double startTime = FirstSeconds; double lastFrameStart = wrappedComparisonRecordInfo.WrappedRecordInfo.Session.Runs.SelectMany(r => r.CaptureData.TimeInSeconds).Last(); double endTime = LastSeconds > lastFrameStart ? lastFrameStart : lastFrameStart + LastSeconds; var frametimeTimeWindow = wrappedComparisonRecordInfo.WrappedRecordInfo.Session.GetFrametimeTimeWindow(startTime, endTime, _appConfiguration, ERemoveOutlierMethod.None); double GeMetricValue(IList <double> sequence, EMetric metric) => _frametimeStatisticProvider.GetFpsMetricValue(sequence, metric); if (SelectedFirstMetric == EMetric.CpuFpsPerWatt) { wrappedComparisonRecordInfo.WrappedRecordInfo.FirstMetric = _frametimeStatisticProvider.GetPhysicalMetricValue(frametimeTimeWindow, EMetric.CpuFpsPerWatt, SensorReport.GetAverageCpuPower(wrappedComparisonRecordInfo.WrappedRecordInfo.Session.Runs.Select(run => run.SensorData2), startTime, endTime)); } else if (SelectedFirstMetric == EMetric.GpuFpsPerWatt) { wrappedComparisonRecordInfo.WrappedRecordInfo.FirstMetric = _frametimeStatisticProvider.GetPhysicalMetricValue(frametimeTimeWindow, EMetric.GpuFpsPerWatt, SensorReport.GetAverageGpuPower(wrappedComparisonRecordInfo.WrappedRecordInfo.Session.Runs.Select(run => run.SensorData2), startTime, endTime)); } else { wrappedComparisonRecordInfo.WrappedRecordInfo.FirstMetric = GeMetricValue(frametimeTimeWindow, SelectedFirstMetric); } if (SelectedSecondMetric == EMetric.CpuFpsPerWatt) { wrappedComparisonRecordInfo.WrappedRecordInfo.SecondMetric = _frametimeStatisticProvider.GetPhysicalMetricValue(frametimeTimeWindow, EMetric.CpuFpsPerWatt, SensorReport.GetAverageCpuPower(wrappedComparisonRecordInfo.WrappedRecordInfo.Session.Runs.Select(run => run.SensorData2), startTime, endTime)); } else if (SelectedSecondMetric == EMetric.GpuFpsPerWatt) { wrappedComparisonRecordInfo.WrappedRecordInfo.SecondMetric = _frametimeStatisticProvider.GetPhysicalMetricValue(frametimeTimeWindow, EMetric.GpuFpsPerWatt, SensorReport.GetAverageGpuPower(wrappedComparisonRecordInfo.WrappedRecordInfo.Session.Runs.Select(run => run.SensorData2), startTime, endTime)); } else { wrappedComparisonRecordInfo.WrappedRecordInfo.SecondMetric = GeMetricValue(frametimeTimeWindow, SelectedSecondMetric); } if (SelectedThirdMetric == EMetric.CpuFpsPerWatt) { wrappedComparisonRecordInfo.WrappedRecordInfo.ThirdMetric = _frametimeStatisticProvider.GetPhysicalMetricValue(frametimeTimeWindow, EMetric.CpuFpsPerWatt, SensorReport.GetAverageCpuPower(wrappedComparisonRecordInfo.WrappedRecordInfo.Session.Runs.Select(run => run.SensorData2), startTime, endTime)); } else if (SelectedThirdMetric == EMetric.GpuFpsPerWatt) { wrappedComparisonRecordInfo.WrappedRecordInfo.ThirdMetric = _frametimeStatisticProvider.GetPhysicalMetricValue(frametimeTimeWindow, EMetric.GpuFpsPerWatt, SensorReport.GetAverageGpuPower(wrappedComparisonRecordInfo.WrappedRecordInfo.Session.Runs.Select(run => run.SensorData2), startTime, endTime)); } else { wrappedComparisonRecordInfo.WrappedRecordInfo.ThirdMetric = GeMetricValue(frametimeTimeWindow, SelectedThirdMetric); } }