Skip to content

Commit 5afe3dd

Browse files
Merge branch '2018.2' into 2018.1
2 parents 5f88f22 + 7f8c08c commit 5afe3dd

File tree

6 files changed

+85
-70
lines changed

6 files changed

+85
-70
lines changed

UnityPerformanceBenchmarkReporter/MetadataValidator.cs

Lines changed: 36 additions & 53 deletions
Large diffs are not rendered by default.

UnityPerformanceBenchmarkReporter/OptionsParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void ParseOptions(PerformanceBenchmark performanceBenchmark, IEnumerable<
4343

4444
if (!performanceBenchmark.ResultXmlFilePaths.Any() && !performanceBenchmark.ResultXmlDirectoryPaths.Any())
4545
{
46-
ShowHelp("Missing required option --testresultsxmlsource=(filePath|directoryPath)", os);
46+
ShowHelp("Missing required option --results=(filePath|directoryPath)", os);
4747
}
4848

4949
if (remaining.Any())

UnityPerformanceBenchmarkReporter/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ internal class Program
1010
{
1111
private static readonly Dictionary<string, string[]> ExcludedConfigFieldNames = new Dictionary<string, string[]>
1212
{
13-
{typeof(EditorVersion).Name, new []{"DateSeconds", "RevisionValue", "Branch"}}
13+
{typeof(EditorVersion).Name, new []{"DateSeconds", "RevisionValue", "Branch"}},
14+
{typeof(PlayerSettings).Name, new []{"MtRendering", "GraphicsJobs"}}
1415
};
1516

1617
private static void Main(string[] args)

UnityPerformanceBenchmarkReporter/Report/ReportWriter.cs

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Text;
88
using System.Text.RegularExpressions;
99
using UnityPerformanceBenchmarkReporter.Entities;
10+
using System.Runtime.InteropServices;
1011

1112
namespace UnityPerformanceBenchmarkReporter.Report
1213
{
@@ -20,7 +21,8 @@ public class ReportWriter
2021
"styles.css",
2122
"UnityLogo.png",
2223
"warning.png",
23-
"help.png"
24+
"help.png",
25+
"help-hover.png"
2426
};
2527

2628
private readonly Dictionary<string, string[]> excludedConfigFieldNames = new Dictionary<string, string[]>();
@@ -32,6 +34,8 @@ public class ReportWriter
3234
private uint thisSigFig;
3335
private bool thisHasBenchmarkResults;
3436
private MetadataValidator metadataValidator;
37+
private bool vrSupported = false;
38+
private char pathSeperator = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? '\\' : '/';
3539

3640
public ReportWriter(Dictionary<string, string[]> excludedTestConfigs = null)
3741
{
@@ -99,7 +103,8 @@ private static FileStream TryCreateHtmlFile(string htmlFileName)
99103

100104
private void WriteEmbeddedResourceFiles(DirectoryInfo benchmarkDirectory)
101105
{
102-
var assemblyNameParts = Assembly.GetExecutingAssembly().Location.Split('\\');
106+
var assemblyNameParts = Assembly.GetExecutingAssembly().Location.Split(pathSeperator);
107+
103108
var assemblyName = assemblyNameParts[assemblyNameParts.Length - 1].Split('.')[0];
104109

105110
foreach (var embeddedResourceName in embeddedResourceNames)
@@ -466,6 +471,7 @@ private void WriteToggleCanvasWithNoFailures(StreamWriter rw)
466471
private void WriteHeader(StreamWriter rw)
467472
{
468473
rw.WriteLine("<head>");
474+
rw.WriteLine("<meta charset=\"utf-8\"/>");
469475
rw.WriteLine("<title>Unity Performance Benchmark Report</title>");
470476
rw.WriteLine("<script src=\"Chart.bundle.js\"></script>");
471477
rw.WriteLine("<link rel=\"stylesheet\" href=\"styles.css\">");
@@ -726,9 +732,15 @@ private void WriteClassNameWithFields<T>(StreamWriter rw, object instance, strin
726732

727733
var sb = new StringBuilder();
728734

729-
foreach (var field in thisObject.GetType().GetFields())
735+
if (thisObject.GetType().GetFields().Any(f => f.Name.Equals("VrSupported")))
730736
{
737+
vrSupported = (bool)thisObject.GetType().GetFields().First(f => f.Name.Equals("VrSupported")).GetValue(thisObject);
738+
}
739+
740+
731741

742+
foreach (var field in thisObject.GetType().GetFields())
743+
{
732744
if (excludedFieldNames != null && excludedFieldNames.Contains(field.Name))
733745
{
734746
continue;
@@ -758,8 +770,8 @@ private void WriteClassNameWithFields<T>(StreamWriter rw, object instance, strin
758770
? mismatchedValue.First(kv => kv.Key.Equals(resultFile)).Value
759771
: baselineValue;
760772

761-
var pathParts = resultFile.Split('\\');
762-
var path = string.Join('\\', pathParts.Take(pathParts.Length - 1));
773+
var pathParts = resultFile.Split(pathSeperator);
774+
var path = string.Join(pathSeperator, pathParts.Take(pathParts.Length - 1));
763775

764776

765777
sb.Append(string.Format(
@@ -812,26 +824,42 @@ private static bool TypeHasValidMismatches<T>(Dictionary<string, Dictionary<stri
812824

813825
private object GetFieldValues<T>(FieldInfo field, T thisObject)
814826
{
815-
return IsIEnumerableFieldType(field) ? ConvertIEnumberableToString(field, thisObject) : field.GetValue(thisObject);
827+
return IsIEnumerableFieldType(field) ? ConvertIEnumberableToString(field, thisObject) : GetValue(field, thisObject);
828+
}
829+
830+
private object GetValue<T>(FieldInfo field, T thisObject)
831+
{
832+
return
833+
(field.Name.Equals("StereoRenderingPath") || field.Name.Equals("XrModel") || field.Name.Equals("XrDevice")) && !vrSupported ?
834+
"None" :
835+
field.GetValue(thisObject);
816836
}
817837

818-
private static bool IsIEnumerableFieldType(FieldInfo field)
838+
private bool IsIEnumerableFieldType(FieldInfo field)
819839
{
820840
return typeof(IEnumerable).IsAssignableFrom(field.FieldType) && field.FieldType != typeof(string);
821841
}
822842

823843
private string ConvertIEnumberableToString<T>(FieldInfo field, T thisObject)
824844
{
825845
var sb = new StringBuilder();
826-
foreach (var enumerable in (IEnumerable) field.GetValue(thisObject))
846+
var fieldValues = ((IEnumerable) field.GetValue(thisObject)) as List<string>;
847+
if (fieldValues != null && fieldValues.Any())
827848
{
828-
sb.Append(enumerable + ",");
829-
}
849+
foreach (var enumerable in fieldValues)
850+
{
851+
sb.Append(enumerable + ",");
852+
}
830853

831-
if (sb.ToString().EndsWith(','))
854+
if (sb.ToString().EndsWith(','))
855+
{
856+
// trim trailing comma
857+
sb.Length--;
858+
}
859+
}
860+
else
832861
{
833-
// trim trailing comma
834-
sb.Length--;
862+
sb.Append("None");
835863
}
836864

837865
return sb.ToString();

UnityPerformanceBenchmarkReporter/Report/styles.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ th {
5252
}
5353

5454
.helpwrapper:hover {
55-
background-image: url("help2.png");
55+
background-image: url("help-hover.png");
5656
}
5757

5858
.titletable {
@@ -223,13 +223,15 @@ div:hover > .configwarning {
223223
border: 1px solid lightgray;
224224
border-radius: 4px;
225225
margin: 5px;
226+
vertical-align: top;
226227
}
227228

228229
.fieldgroupwarning {
229230
display: inline-block !important;
230231
border: 1px solid #f28034;
231232
border-radius: 4px;
232233
margin: 5px;
234+
vertical-align: top;
233235
}
234236

235237
.fieldname {
@@ -421,6 +423,7 @@ pre {
421423
width: 99%;
422424
height: 18vh;
423425
font-family: 'Arial', 'Helvetica', 'Helvetica Neue', sans-serif;
426+
min-height: 200px;
424427
}
425428

426429
.divider {

UnityPerformanceBenchmarkReporter/UnityPerformanceBenchmarkReporter.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>

0 commit comments

Comments
 (0)