示例#1
0
        private ReportInfo GetReportInfoFromRecordInfo(IFileRecordInfo recordInfo)
        {
            var session = _recordManager.LoadData(recordInfo.FullPath);

            double GeMetricValue(IList <double> sequence, EMetric metric) =>
            _frametimeStatisticProvider.GetFpsMetricValue(sequence, metric);

            var frameTimes = session.Runs.SelectMany(r => r.CaptureData.MsBetweenPresents).ToList();
            var recordTime = session.Runs.SelectMany(r => r.CaptureData.TimeInSeconds).Last();

            var max                       = GeMetricValue(frameTimes, EMetric.Max);
            var p99_quantile              = GeMetricValue(frameTimes, EMetric.P99);
            var p95_quantile              = GeMetricValue(frameTimes, EMetric.P95);
            var average                   = GeMetricValue(frameTimes, EMetric.Average);
            var median                    = GeMetricValue(frameTimes, EMetric.Median);
            var p0dot1_quantile           = GeMetricValue(frameTimes, EMetric.P0dot1);
            var p0dot2_quantile           = GeMetricValue(frameTimes, EMetric.P0dot2);
            var p1_quantile               = GeMetricValue(frameTimes, EMetric.P1);
            var p5_quantile               = GeMetricValue(frameTimes, EMetric.P5);
            var p1_averageLow             = GeMetricValue(frameTimes, EMetric.OnePercentLow);
            var p0dot1_averageLow         = GeMetricValue(frameTimes, EMetric.ZerodotOnePercentLow);
            var min                       = GeMetricValue(frameTimes, EMetric.Min);
            var adaptiveStandardDeviation = GeMetricValue(frameTimes, EMetric.AdaptiveStd);
            var cpuFpsPerWatt             = _frametimeStatisticProvider
                                            .GetPhysicalMetricValue(frameTimes, EMetric.CpuFpsPerWatt,
                                                                    SensorReport.GetAverageCpuPower(session.Runs.Select(run => run.SensorData),
                                                                                                    0, double.PositiveInfinity));
            //var gpuFpsPerWatt =  _frametimeStatisticProvider
            //	.GetPhysicalMetricValue(frameTimes, EMetric.GpuFpsPerWatt,
            //	SensorReport.GetAverageGpuPower(session.Runs.Select(run => run.SensorData),
            //	0, double.PositiveInfinity));

            var reportInfo = new ReportInfo()
            {
                Game            = recordInfo.GameName,
                Resolution      = recordInfo.Resolution,
                Date            = recordInfo.CreationDate,
                Time            = recordInfo.CreationTime,
                NumberOfSamples = frameTimes.Count,
                RecordTime      = Math.Round(recordTime, 2).ToString(),
                Cpu             = recordInfo.ProcessorName == null ? "" : recordInfo.ProcessorName.Trim(new Char[] { ' ', '"' }),
                GraphicCard     = recordInfo.GraphicCardName == null ? "" : recordInfo.GraphicCardName.Trim(new Char[] { ' ', '"' }),
                Ram             = recordInfo.SystemRamInfo == null ? "" : recordInfo.SystemRamInfo.Trim(new Char[] { ' ', '"' }),
                MaxFps          = max,
                NinetyNinePercentQuantileFps = p99_quantile,
                NinetyFivePercentQuantileFps = p95_quantile,
                AverageFps                     = average,
                MedianFps                      = median,
                FivePercentQuantileFps         = p5_quantile,
                OnePercentQuantileFps          = p1_quantile,
                OnePercentLowAverageFps        = p1_averageLow,
                ZeroDotTwoPercentQuantileFps   = p0dot2_quantile,
                ZeroDotOnePercentQuantileFps   = p0dot1_quantile,
                ZeroDotOnePercentLowAverageFps = p0dot1_averageLow,
                MinFps         = min,
                AdaptiveSTDFps = adaptiveStandardDeviation,
                CpuFpsPerWatt  = cpuFpsPerWatt,
                //GpuFpsPerWatt = gpuFpsPerWatt,
                CustomComment = recordInfo.Comment
            };

            return(reportInfo);
        }
        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);
            }
        }