Skip to content

Commit e0e2508

Browse files
amaestas13GitHub Enterprise
authored andcommitted
Merge pull request #5 from unity/JsonParserUpdate
Update PBR to support Json format performance test run files
2 parents 0aaef26 + e062f85 commit e0e2508

26 files changed

+13652
-134
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace UnityPerformanceBenchmarkReporter.Entities
2+
{
3+
public enum ESupportedFileTypes
4+
{
5+
json,
6+
xml
7+
}
8+
}

UnityPerformanceBenchmarkReporter/Entities/Data.cs

Lines changed: 4 additions & 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;
@@ -65,6 +66,9 @@ public class Hardware
6566
public int ProcessorCount;
6667
public string GraphicsDeviceName;
6768
public int SystemMemorySizeMB;
69+
70+
public string XrModel ;
71+
public string XrDevice;
6872
}
6973

7074
[Serializable]

UnityPerformanceBenchmarkReporter/Entities/PerformanceTestRun.cs

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,25 @@ public class PerformanceTestRun
1212
public ScreenSettings ScreenSettings;
1313
public QualitySettings QualitySettings;
1414
public PlayerSettings PlayerSettings;
15+
public ProjectVersion ProjectVersion;
16+
17+
public string TestProject;
1518
public string TestSuite;
1619
public double StartTime;
1720
public double EndTime;
1821
public List<PerformanceTestResult> Results = new List<PerformanceTestResult>();
22+
23+
public JobMetaData JobMetaData ;
24+
public object Dependencies;
25+
}
26+
27+
[Serializable]
28+
public class ProjectVersion
29+
{
30+
public string ProjectName { get; set; }
31+
public string Branch { get; set; }
32+
public string Changeset { get; set; }
33+
public DateTime Date { get; set; }
1934
}
2035

2136
[Serializable]
@@ -73,19 +88,40 @@ public class QualitySettings
7388
public class PlayerSettings
7489
{
7590
public string ScriptingBackend;
76-
public string ScriptingRuntimeVersion;
7791
public bool VrSupported;
7892
public bool MtRendering;
7993
public bool GraphicsJobs;
8094
public bool GpuSkinning;
8195
public string GraphicsApi;
82-
//public string Batchmode; TODO
96+
public string Batchmode;
8397
//public int StaticBatching; TODO
8498
//public int DynamicBatching; TODO
8599
public string StereoRenderingPath;
86100
public string RenderThreadingMode;
87101
public string AndroidMinimumSdkVersion;
88102
public string AndroidTargetSdkVersion;
89103
public List<string> EnabledXrTargets;
104+
105+
public string ScriptingRuntimeVersion;
106+
}
107+
108+
109+
[Serializable]
110+
public class Yamato
111+
{
112+
public string JobFriendlyName { get; set; }
113+
public string JobName { get; set; }
114+
public string JobId { get; set; }
115+
public string ProjectId { get; set; }
116+
public string ProjectName { get; set; }
117+
public object WorkDir { get; set; }
118+
public object JobOwnerEmail { get; set; }
119+
}
120+
121+
[Serializable]
122+
public class JobMetaData
123+
{
124+
public Yamato Yamato { get; set; }
125+
public object Bokken { get; set; }
90126
}
91127
}

UnityPerformanceBenchmarkReporter/Entities/SampleGroup.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public class SampleGroupDefinition
2828
public double Threshold;
2929
public bool IncreaseIsBetter;
3030
public double Percentile;
31+
32+
public bool FailOnBaseline;
3133
}
3234

3335
public enum AggregationType

UnityPerformanceBenchmarkReporter/Entities/SampleGroupResult.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class SampleGroupResult
1212
public string AggregationType;
1313
public double Percentile;
1414
public bool Regressed;
15+
public bool Progressed;
1516
public double Min;
1617
public double Max;
1718
public double Median;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using UnityPerformanceBenchmarkReporter.Entities;
2+
3+
namespace UnityPerformanceBenchmarkReporter
4+
{
5+
public interface IParser
6+
{
7+
public PerformanceTestRun Parse(string path,int version);
8+
}
9+
}

UnityPerformanceBenchmarkReporter/OptionsParser.cs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void ParseOptions(PerformanceBenchmark performanceBenchmark, IEnumerable<
4141
ShowHelp(string.Empty, os);
4242
}
4343

44-
if (!performanceBenchmark.ResultXmlFilePaths.Any() && !performanceBenchmark.ResultXmlDirectoryPaths.Any())
44+
if (!performanceBenchmark.ResultFilePaths.Any() && !performanceBenchmark.ResultDirectoryPaths.Any())
4545
{
4646
ShowHelp("Missing required option --results=(filePath|directoryPath)", os);
4747
}
@@ -61,20 +61,22 @@ public void ParseOptions(PerformanceBenchmark performanceBenchmark, IEnumerable<
6161
private OptionSet GetOptions(PerformanceBenchmark performanceBenchmark)
6262
{
6363
var optionsSet = new OptionSet();
64-
optionsSet.Add("?|help|h", "Prints out the options.", option => help = option != null);
65-
optionsSet.Add(
66-
"results|testresultsxmlsource=",
67-
"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.",
68-
xmlsource => performanceBenchmark.AddXmlSourcePath(xmlsource, "results", ResultType.Test));
69-
optionsSet.Add(
70-
"baseline|baselinexmlsource:", "OPTIONAL - Path to a baseline XML filename.",
71-
xmlsource => performanceBenchmark.AddXmlSourcePath(xmlsource, "baseline", ResultType.Baseline));
72-
optionsSet.Add(
73-
"report|reportdirpath:", "OPTIONAL - Path to where the report will be written. Default is current working directory.",
74-
performanceBenchmark.AddReportDirPath);
75-
optionsSet.Add("failonbaseline",
76-
"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.",
77-
option => performanceBenchmark.FailOnBaseline = option != null);
64+
optionsSet.Add("?|help|h", "Prints out the options.", option => help = option != null);
65+
optionsSet.Add("dataversion|version=", "Sets Expected Perf Data Version for Results and Baseline Files (1 = V1 2 = V2). Versions of Unity Perf Framework 2.0 or newer will use the V2 data format. If no arg is provided we assume the format is V2", version => performanceBenchmark.SetDataVersion(version));
66+
optionsSet.Add("fileformat|format=", "Sets Expected File Format for Results and Baseline Files. If no arg is provided we assume the format is XML", filtype => performanceBenchmark.SetFileType(filtype));
67+
optionsSet.Add(
68+
"results|testresultsxmlsource=",
69+
"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.",
70+
xmlsource => performanceBenchmark.AddSourcePath(xmlsource, "results", ResultType.Test));
71+
optionsSet.Add(
72+
"baseline|baselinexmlsource:", "OPTIONAL - Path to a baseline XML filename.",
73+
xmlsource => performanceBenchmark.AddSourcePath(xmlsource, "baseline", ResultType.Baseline));
74+
optionsSet.Add(
75+
"report|reportdirpath:", "OPTIONAL - Path to where the report will be written. Default is current working directory.",
76+
performanceBenchmark.AddReportDirPath);
77+
optionsSet.Add("failonbaseline",
78+
"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.",
79+
option => performanceBenchmark.FailOnBaseline = option != null);
7880
return optionsSet;
7981
}
8082

0 commit comments

Comments
 (0)