Skip to content

Commit 80afdbc

Browse files
committed
Added Threshold to V2 Data Format Parsing
Fixed Standard Deviation in Pass Fail Calculation
1 parent 8f28284 commit 80afdbc

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

UnityPerformanceBenchmarkReporter/Entities/Data.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class SampleGroup
1818
public string Name;
1919
public SampleUnit Unit;
2020
public bool IncreaseIsBetter;
21+
public double Threshold = 0.15;
2122
public List<double> Samples = new List<double>();
2223
public double Min;
2324
public double Max;

UnityPerformanceBenchmarkReporter/PerformanceTestRunProcessor.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,8 @@ private double GetAggregatedSampleValue(SampleGroup sampleGroup)
163163
private MeasurementResult DeterminePerformanceResult(SampleGroupResult sampleGroup, uint sigFig)
164164
{
165165
var measurementResult = MeasurementResult.Neutral;
166-
var positiveThresholdValue = sampleGroup.BaselineValue + sampleGroup.BaselineValue * sampleGroup.Threshold;
167-
var negativeThresholdValue = sampleGroup.BaselineValue - sampleGroup.BaselineValue * sampleGroup.Threshold;
168-
positiveThresholdValue += sampleGroup.StandardDeviation;
169-
negativeThresholdValue -= sampleGroup.StandardDeviation;
166+
var positiveThresholdValue = sampleGroup.BaselineValue + (sampleGroup.BaselineValue + sampleGroup.StandardDeviation) * sampleGroup.Threshold;
167+
var negativeThresholdValue = sampleGroup.BaselineValue - (sampleGroup.BaselineValue + sampleGroup.StandardDeviation) * sampleGroup.Threshold;
170168

171169
if (sampleGroup.IncreaseIsBetter)
172170
{

UnityPerformanceBenchmarkReporter/TestResultJsonParser.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ private static PerformanceTestRun ParseJsonV2(string json)
163163
{
164164
Name = sg.Name,
165165
SampleUnit = (Entities.SampleUnit)sg.Unit,
166-
IncreaseIsBetter = sg.IncreaseIsBetter
166+
IncreaseIsBetter = sg.IncreaseIsBetter,
167+
Threshold = sg.Threshold
167168
}
168169
}).ToList()
169170
};

UnityPerformanceBenchmarkReporter/TestResultXmlParser.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,13 @@ private static void DeserializeTestResultsV2(IEnumerable<XElement> output, Perfo
9090
Sum = sg.Sum,
9191
StandardDeviation = sg.StandardDeviation,
9292
SampleCount = sg.Samples.Count,
93+
9394
Definition = new SampleGroupDefinition()
9495
{
9596
Name = sg.Name,
9697
SampleUnit = (Entities.SampleUnit)sg.Unit,
97-
IncreaseIsBetter = sg.IncreaseIsBetter
98+
IncreaseIsBetter = sg.IncreaseIsBetter,
99+
Threshold = sg.Threshold
98100
}
99101
}).ToList()
100102
};

0 commit comments

Comments
 (0)