Skip to content

Commit 839b3aa

Browse files
amaestas13GitHub Enterprise
authored and
GitHub Enterprise
committed
Merge pull request #9 from unity/SupportIgnoringMetrics
ignore metrics
2 parents 395d919 + cfa00e3 commit 839b3aa

File tree

6 files changed

+4710
-1008
lines changed

6 files changed

+4710
-1008
lines changed

UnityPerformanceBenchmarkReporter/OptionsParser.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ private OptionSet GetOptions(PerformanceBenchmark performanceBenchmark)
7474
optionsSet.Add(
7575
"report|reportdirpath:", "OPTIONAL - Path to where the report will be written. Default is current working directory.",
7676
performanceBenchmark.AddReportDirPath);
77+
optionsSet.Add("ignore:",
78+
"send in ; seperated list of metric names. These metrics are ignored and not compared even if they both exist on baseline and results",
79+
option => performanceBenchmark.SetIgnoredMetrics(option));
7780
optionsSet.Add("failonbaseline",
7881
"Enable return '1' by the reporter if a baseline is passed in and one or more matching configs is out of threshold. Disabled is default. Use option to enable, or use option and append '-' to explicitly disable.",
7982
option => performanceBenchmark.FailOnBaseline = option != null);

UnityPerformanceBenchmarkReporter/PerformanceBenchmark.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public PerformanceBenchmark(Dictionary<Type, string[]> configFieldNames = null)
3838

3939
public bool ResultFilesExist => ResultFilePaths.Any() || ResultDirectoryPaths.Any();
4040

41+
public List<string> IgnoredMetrics = new List<string>();
42+
4143

4244
public void AddPerformanceTestRunResults(
4345
IParser testResultParser,
@@ -116,7 +118,7 @@ private void AddTestResults(
116118

117119
testResults.AddRange(results);
118120

119-
performanceTestRunProcessor.UpdateTestResultsBasedOnBaselineResults(baselineTestResults, testResults, SigFig);
121+
performanceTestRunProcessor.UpdateTestResultsBasedOnBaselineResults(baselineTestResults, IgnoredMetrics, testResults, SigFig);
120122

121123
TestRunMetadataProcessor.ProcessMetadata(performanceTestRun, resultFilesOrderedByResultName[i].Key);
122124

@@ -131,6 +133,11 @@ private void AddTestResults(
131133
}
132134
}
133135

136+
public void SetIgnoredMetrics(string metrics)
137+
{
138+
IgnoredMetrics = metrics.Split(';').ToList();
139+
}
140+
134141
public void SetDataVersion(string version)
135142
{
136143
if (int.TryParse(version, out int result))

UnityPerformanceBenchmarkReporter/PerformanceTestRunProcessor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public List<TestResult> GetTestResults(
6262
return performanceTestResults;
6363
}
6464

65-
public void UpdateTestResultsBasedOnBaselineResults(List<TestResult> baselineTestResults,
65+
public void UpdateTestResultsBasedOnBaselineResults(List<TestResult> baselineTestResults, List<string> ignoredMetrics,
6666
List<TestResult> testResults, uint sigfig)
6767
{
6868
foreach (var testResult in testResults)
@@ -76,7 +76,7 @@ public void UpdateTestResultsBasedOnBaselineResults(List<TestResult> baselineTes
7676
foreach (var sampleGroupResult in testResult.SampleGroupResults)
7777
{
7878
// if we have a corresponding baseline samplegroupname in this sampleGroupResult, compare them
79-
if (baselineSampleGroupResults.Any(sg => sg.SampleGroupName == sampleGroupResult.SampleGroupName))
79+
if ( baselineSampleGroupResults.Any(sg => sg.SampleGroupName == sampleGroupResult.SampleGroupName && !ignoredMetrics.Contains(sampleGroupResult.SampleGroupName)) )
8080
{
8181
// Get the baselineSampleGroupResult that corresponds to this SampleGroupResults sample group name
8282
var baselineSampleGroupResult = baselineSampleGroupResults.First(sg => sg.SampleGroupName == sampleGroupResult.SampleGroupName);

UnityPerformanceBenchmarkReporterTests/TestData/BaselineJson/baseline.json

Lines changed: 2348 additions & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)