Skip to content

Commit 5f88f22

Browse files
Merge branch '2018.2' into 2018.1
2 parents 78ea99e + 2079762 commit 5f88f22

File tree

9 files changed

+234
-147
lines changed

9 files changed

+234
-147
lines changed

MismatchedConfigTooltip.png

58.7 KB
Loading

TestConfigWithMismatchedItems.png

107 KB
Loading
-81.8 KB
Loading

UnityPerformanceBenchmarkReporter/MetadataValidator.cs

Lines changed: 79 additions & 73 deletions
Large diffs are not rendered by default.

UnityPerformanceBenchmarkReporter/OptionsParser.cs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ public class OptionsParser
1313
private readonly string learnMore =
1414
"To learn more about the Unity Performance Benchmark Reporter visit the Unity Performance Benchmark Reporter GitHub wiki at https://github.com/Unity-Technologies/PerformanceBenchmarkReporter/wiki.";
1515

16+
private readonly string commandLineOptionFormat =
17+
"// Command line option format\r\n--results=<Path to a test result XML filename OR directory>... [--baseline=\"Path to a baseline XML filename\"] [--reportdirpath=\"Path to where the report will be written\"]";
18+
19+
private readonly string example1 = "// Run reporter with one performance test result .xml file\r\n--results=\"G:\\My Drive\\XRPerfRuns\\results\\results.xml\"";
20+
21+
private readonly string example2 = "// Run reporter against a directory containing one or more performance test result .xml files\r\n--results=\"G:\\My Drive\\XRPerfRuns\\results\" ";
22+
23+
private readonly string example3 = "// Run reporter against a directory containing one or more performance test result .xml files, and a baseline .xml result file\r\n--results=\"G:\\My Drive\\XRPerfRuns\\results\" --baseline=\"G:\\My Drive\\XRPerfRuns\\baselines\\baseline.xml\" ";
24+
1625
public enum ResultType
1726
{
1827
Test,
@@ -53,17 +62,17 @@ private OptionSet GetOptions(PerformanceBenchmark performanceBenchmark)
5362
{
5463
return new OptionSet()
5564
.Add("?|help|h", "Prints out the options.", option => help = option != null)
56-
.Add("testresultsxmlsource=", "REQUIRED - Path to a test result XML filename or directory. Directories are searched resursively. You can repeat this option with multiple result file or directory paths.",
65+
.Add("results|testresultsxmlsource=", "REQUIRED - Path to a test result XML filename OR directory. Directories are searched resursively. You can repeat this option with multiple result file or directory paths.",
5766
xmlsource =>
5867
{
5968
performanceBenchmark.AddXmlSourcePath(xmlsource, "testresultsxmlsource", ResultType.Test);
6069
})
61-
.Add("baselinexmlsource:", "OPTIONAL - Path to a baseline XML filename or directory. Directories are searched resursively. You can repeat this option with multiple baseline file or directory paths.",
70+
.Add("baseline|baselinexmlsource:", "OPTIONAL - Path to a baseline XML filename.",
6271
xmlsource =>
6372
{
6473
performanceBenchmark.AddXmlSourcePath(xmlsource, "baselinexmlsource", ResultType.Baseline);
6574
})
66-
.Add("reportdirpath:", "OPTIONAL - Path to directory where the UnityPerformanceBenchmark report will be written. Default is current working directory.",
75+
.Add("report|reportdirpath:", "OPTIONAL - Path to where the report will be written. Default is current working directory.",
6776
performanceBenchmark.AddReportDirPath);
6877
}
6978

@@ -78,7 +87,12 @@ private void ShowHelp(string message, OptionSet optionSet)
7887

7988
Console.WriteLine(about + "\r\n");
8089
Console.WriteLine(learnMore + "\r\n");
81-
Console.WriteLine("Usage is:");
90+
Console.WriteLine("Usage is:" + "\r\n");
91+
Console.WriteLine(commandLineOptionFormat + "\r\n");
92+
Console.WriteLine(example1 + "\r\n");
93+
Console.WriteLine(example2 + "\r\n");
94+
Console.WriteLine(example3 + "\r\n");
95+
Console.WriteLine("Options: \r\n");
8296
optionSet.WriteOptionDescriptions(Console.Error);
8397
Environment.Exit(-1);
8498
}

UnityPerformanceBenchmarkReporter/PerformanceBenchmark.cs

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,25 @@ public class PerformanceBenchmark
2323
private PerformanceTestRun firstTestRun = new PerformanceTestRun();
2424
private readonly PerformanceTestRunProcessor performanceTestRunProcessor = new PerformanceTestRunProcessor();
2525
private readonly string xmlFileExtension = ".xml";
26+
private readonly Dictionary<string, string[]> excludedConfigFieldNames = new Dictionary<string, string[]>();
2627

2728

2829
public bool BaselineResultFilesExist => BaselineXmlFilePaths.Any() || BaselineXmlDirectoryPaths.Any();
2930

3031
public bool ResultFilesExist => ResultXmlFilePaths.Any() || ResultXmlDirectoryPaths.Any();
3132

32-
public PerformanceBenchmark()
33+
public PerformanceBenchmark(Dictionary<string, string[]> configFieldNames = null)
3334
{
3435
// Default significant figures to use for non-integer metrics if user doesn't specify another value.
3536
// Most values are in milliseconds or a count of something, so using more often creates an artificial baseline
3637
// failure based on insignificant digits equating to a microsecond, or less, time difference. The Unity Profiler only shows
37-
// up to three significant figures for milliseconds as well.
38+
// up to 2 significant figures for milliseconds as well, so this is what folks are used to working with.
3839
SigFig = 2;
40+
41+
if (configFieldNames != null)
42+
{
43+
excludedConfigFieldNames = configFieldNames;
44+
}
3945
}
4046

4147
public void AddPerformanceTestRunResults(
@@ -55,7 +61,7 @@ public void AddBaselinePerformanceTestRunResults(
5561
AddTestResults(testResultXmlParser, baselinePerformanceTestRunResults, baselineTestResults, baselineTestResults, BaselineXmlDirectoryPaths, BaselineXmlFilePaths, true);
5662
}
5763

58-
public void AddTestResults(
64+
private void AddTestResults(
5965
TestResultXmlParser testResultXmlParser,
6066
List<PerformanceTestRunResult> runResults,
6167
List<TestResult> testResults,
@@ -64,7 +70,7 @@ public void AddTestResults(
6470
HashSet<string> xmlFileNamePaths,
6571
bool isBaseline = false)
6672
{
67-
if (xmlDirectoryPaths.Any())
73+
if (!isBaseline && xmlDirectoryPaths.Any())
6874
{
6975
foreach (var xmlDirectory in xmlDirectoryPaths)
7076
{
@@ -140,15 +146,22 @@ private void ValidateMetadata(PerformanceTestRun performanceTestRun, string xmlF
140146
}
141147
else
142148
{
143-
MetadataValidator.ValidatePlayerSystemInfo(firstTestRun, performanceTestRun, firstTestRunResultPath, xmlFileNamePath);
144-
MetadataValidator.ValidatePlayerSettings(firstTestRun, performanceTestRun, firstTestRunResultPath, xmlFileNamePath);
145-
MetadataValidator.ValidateQualitySettings(firstTestRun, performanceTestRun, firstTestRunResultPath, xmlFileNamePath);
146-
MetadataValidator.ValidateScreenSettings(firstTestRun, performanceTestRun, firstTestRunResultPath, xmlFileNamePath);
147-
MetadataValidator.ValidateBuildSettings(firstTestRun, performanceTestRun, firstTestRunResultPath, xmlFileNamePath);
148-
MetadataValidator.ValidateEditorVersion(firstTestRun, performanceTestRun, firstTestRunResultPath, xmlFileNamePath);
149+
MetadataValidator.ValidatePlayerSystemInfo(firstTestRun, performanceTestRun, firstTestRunResultPath, xmlFileNamePath, ExcludedFieldNames<PlayerSystemInfo>());
150+
MetadataValidator.ValidatePlayerSettings(firstTestRun, performanceTestRun, firstTestRunResultPath, xmlFileNamePath, ExcludedFieldNames<PlayerSettings>());
151+
MetadataValidator.ValidateQualitySettings(firstTestRun, performanceTestRun, firstTestRunResultPath, xmlFileNamePath, ExcludedFieldNames<QualitySettings>());
152+
MetadataValidator.ValidateScreenSettings(firstTestRun, performanceTestRun, firstTestRunResultPath, xmlFileNamePath, ExcludedFieldNames<ScreenSettings>());
153+
MetadataValidator.ValidateBuildSettings(firstTestRun, performanceTestRun, firstTestRunResultPath, xmlFileNamePath, ExcludedFieldNames<BuildSettings>());
154+
MetadataValidator.ValidateEditorVersion(firstTestRun, performanceTestRun, firstTestRunResultPath, xmlFileNamePath, ExcludedFieldNames<EditorVersion>());
149155
}
150156
}
151157

158+
private string[] ExcludedFieldNames<T>()
159+
{
160+
return excludedConfigFieldNames.ContainsKey(typeof(T).Name)
161+
? excludedConfigFieldNames[typeof(T).Name]
162+
: null;
163+
}
164+
152165
public void AddXmlSourcePath(string xmlSourcePath, string optionName, OptionsParser.ResultType resultType)
153166
{
154167
if (string.IsNullOrEmpty(xmlSourcePath))

UnityPerformanceBenchmarkReporter/Program.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,19 @@ namespace UnityPerformanceBenchmarkReporter
88
{
99
internal class Program
1010
{
11+
private static readonly Dictionary<string, string[]> ExcludedConfigFieldNames = new Dictionary<string, string[]>
12+
{
13+
{typeof(EditorVersion).Name, new []{"DateSeconds", "RevisionValue", "Branch"}}
14+
};
15+
1116
private static void Main(string[] args)
1217
{
1318
var aggregateTestRunResults = new List<PerformanceTestRunResult>();
1419
var baselinePerformanceTestRunResults = new List<PerformanceTestRunResult>();
1520
var baselineTestResults = new List<TestResult>();
1621
var performanceTestRunResults = new List<PerformanceTestRunResult>();
1722
var testResults = new List<TestResult>();
18-
var performanceBenchmark = new PerformanceBenchmark();
23+
var performanceBenchmark = new PerformanceBenchmark(ExcludedConfigFieldNames);
1924
var optionsParser = new OptionsParser();
2025

2126
optionsParser.ParseOptions(performanceBenchmark, args);
@@ -49,8 +54,13 @@ private static void Main(string[] args)
4954
}
5055
}
5156

52-
var reportWriter = new ReportWriter();
53-
reportWriter.WriteReport(aggregateTestRunResults, performanceBenchmark.MetadataValidator, performanceBenchmark.SigFig, performanceBenchmark.ReportDirPath, performanceBenchmark.BaselineResultFilesExist);
57+
var reportWriter = new ReportWriter(ExcludedConfigFieldNames);
58+
reportWriter.WriteReport(
59+
aggregateTestRunResults,
60+
performanceBenchmark.MetadataValidator,
61+
performanceBenchmark.SigFig,
62+
performanceBenchmark.ReportDirPath,
63+
performanceBenchmark.BaselineResultFilesExist);
5464
}
5565
}
5666
}

0 commit comments

Comments
 (0)