From 80afdbce6fd8700c36967840bf12a83c014b19c1 Mon Sep 17 00:00:00 2001 From: "andre.maestas" Date: Fri, 25 Mar 2022 10:57:45 -0700 Subject: [PATCH] Added Threshold to V2 Data Format Parsing Fixed Standard Deviation in Pass Fail Calculation --- UnityPerformanceBenchmarkReporter/Entities/Data.cs | 1 + .../PerformanceTestRunProcessor.cs | 6 ++---- UnityPerformanceBenchmarkReporter/TestResultJsonParser.cs | 3 ++- UnityPerformanceBenchmarkReporter/TestResultXmlParser.cs | 4 +++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/UnityPerformanceBenchmarkReporter/Entities/Data.cs b/UnityPerformanceBenchmarkReporter/Entities/Data.cs index fd4ec07..9846fb6 100644 --- a/UnityPerformanceBenchmarkReporter/Entities/Data.cs +++ b/UnityPerformanceBenchmarkReporter/Entities/Data.cs @@ -18,6 +18,7 @@ namespace UnityPerformanceBenchmarkReporter.Entities.New public string Name; public SampleUnit Unit; public bool IncreaseIsBetter; + public double Threshold = 0.15; public List Samples = new List(); public double Min; public double Max; diff --git a/UnityPerformanceBenchmarkReporter/PerformanceTestRunProcessor.cs b/UnityPerformanceBenchmarkReporter/PerformanceTestRunProcessor.cs index 0adb1db..b0f9d3a 100644 --- a/UnityPerformanceBenchmarkReporter/PerformanceTestRunProcessor.cs +++ b/UnityPerformanceBenchmarkReporter/PerformanceTestRunProcessor.cs @@ -163,10 +163,8 @@ namespace UnityPerformanceBenchmarkReporter private MeasurementResult DeterminePerformanceResult(SampleGroupResult sampleGroup, uint sigFig) { var measurementResult = MeasurementResult.Neutral; - var positiveThresholdValue = sampleGroup.BaselineValue + sampleGroup.BaselineValue * sampleGroup.Threshold; - var negativeThresholdValue = sampleGroup.BaselineValue - sampleGroup.BaselineValue * sampleGroup.Threshold; - positiveThresholdValue += sampleGroup.StandardDeviation; - negativeThresholdValue -= sampleGroup.StandardDeviation; + var positiveThresholdValue = sampleGroup.BaselineValue + (sampleGroup.BaselineValue + sampleGroup.StandardDeviation) * sampleGroup.Threshold; + var negativeThresholdValue = sampleGroup.BaselineValue - (sampleGroup.BaselineValue + sampleGroup.StandardDeviation) * sampleGroup.Threshold; if (sampleGroup.IncreaseIsBetter) { diff --git a/UnityPerformanceBenchmarkReporter/TestResultJsonParser.cs b/UnityPerformanceBenchmarkReporter/TestResultJsonParser.cs index 480120b..bcb514f 100644 --- a/UnityPerformanceBenchmarkReporter/TestResultJsonParser.cs +++ b/UnityPerformanceBenchmarkReporter/TestResultJsonParser.cs @@ -163,7 +163,8 @@ namespace UnityPerformanceBenchmarkReporter { Name = sg.Name, SampleUnit = (Entities.SampleUnit)sg.Unit, - IncreaseIsBetter = sg.IncreaseIsBetter + IncreaseIsBetter = sg.IncreaseIsBetter, + Threshold = sg.Threshold } }).ToList() }; diff --git a/UnityPerformanceBenchmarkReporter/TestResultXmlParser.cs b/UnityPerformanceBenchmarkReporter/TestResultXmlParser.cs index d40ffd1..eb77b39 100644 --- a/UnityPerformanceBenchmarkReporter/TestResultXmlParser.cs +++ b/UnityPerformanceBenchmarkReporter/TestResultXmlParser.cs @@ -90,11 +90,13 @@ namespace UnityPerformanceBenchmarkReporter Sum = sg.Sum, StandardDeviation = sg.StandardDeviation, SampleCount = sg.Samples.Count, + Definition = new SampleGroupDefinition() { Name = sg.Name, SampleUnit = (Entities.SampleUnit)sg.Unit, - IncreaseIsBetter = sg.IncreaseIsBetter + IncreaseIsBetter = sg.IncreaseIsBetter, + Threshold = sg.Threshold } }).ToList() };