Removing sigfig option; not necessary enough to justify the work to explain and maintain. Update formatting in tool tip to use line breaks, add a Regression type message in tooltip so it's clear which ones are (on top of the red color). Add a help icon with link to GitHub wiki

This commit is contained in:
Sean Stolberg 2018-08-21 22:22:09 -07:00
Родитель 5ccdb266a6
Коммит 1d18dc3e5e
7 изменённых файлов: 111 добавлений и 72 удалений

Просмотреть файл

@ -13,8 +13,6 @@ namespace UnityPerformanceBenchmarkReporter
private readonly string learnMore =
"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.";
private string sigFigString;
public enum ResultType
{
Test,
@ -34,19 +32,6 @@ namespace UnityPerformanceBenchmarkReporter
ShowHelp(string.Empty, os);
}
if (!string.IsNullOrEmpty(sigFigString))
{
try
{
var sigFig = Convert.ToUInt32(sigFigString);
performanceBenchmark.AddSigFig(sigFig);
}
catch (Exception)
{
ShowHelp(string.Format("Error trying to convert sigfig value {0} to integer >= 0.", sigFigString), os);
}
}
if (!performanceBenchmark.ResultXmlFilePaths.Any() && !performanceBenchmark.ResultXmlDirectoryPaths.Any())
{
ShowHelp("Missing required option --testresultsxmlsource=(filePath|directoryPath)", os);
@ -79,15 +64,7 @@ namespace UnityPerformanceBenchmarkReporter
performanceBenchmark.AddXmlSourcePath(xmlsource, "baselinexmlsource", ResultType.Baseline);
})
.Add("reportdirpath:", "OPTIONAL - Path to directory where the UnityPerformanceBenchmark report will be written. Default is current working directory.",
performanceBenchmark.AddReportDirPath)
.Add("sigfig:", "OPTIONAL - Specify the number of significant figures to use when collecting and calculating thresholds and failures for non-integer based metrics (from the profiler, Camer.Render CPU time in milliseconds, for example). This value must be an integer >= 0. Default is 3.",
option =>
{
if (option != null)
{
sigFigString = option;
}
});
performanceBenchmark.AddReportDirPath);
}
private void ShowHelp(string message, OptionSet optionSet)

Просмотреть файл

@ -35,7 +35,7 @@ namespace UnityPerformanceBenchmarkReporter
// Most values are in milliseconds or a count of something, so using more often creates an artificial baseline
// failure based on insignificant digits equating to a microsecond, or less, time difference. The Unity Profiler only shows
// up to three significant figures for milliseconds as well.
SigFig = 3;
SigFig = 2;
}
public void AddPerformanceTestRunResults(

Просмотреть файл

@ -19,7 +19,8 @@ namespace UnityPerformanceBenchmarkReporter.Report
"Chart.bundle.js",
"styles.css",
"UnityLogo.png",
"warning.png"
"warning.png",
"help.png"
};
private List<string> distinctTestNames;
@ -155,7 +156,7 @@ namespace UnityPerformanceBenchmarkReporter.Report
private void WriteTestConfig(StreamWriter streamWriter)
{
streamWriter.Write("<table class=\"testconfigtable\">");
streamWriter.WriteLine("<tr><td>");
streamWriter.WriteLine("<tr><td class=\"flex\">");
WriteShowTestConfigButton(streamWriter);
streamWriter.WriteLine("</td></tr>");
streamWriter.WriteLine("<tr><td>");
@ -211,7 +212,7 @@ namespace UnityPerformanceBenchmarkReporter.Report
{
rw.WriteLine(
"<div><button id=\"toggleconfig\" class=\"button\" onclick=\"showTestConfiguration()\">{0}Show Test Configuration</button>{1}</div>",
"<div class=\"toggleconfigwrapper\"><button id=\"toggleconfig\" class=\"button\" onclick=\"showTestConfiguration()\">{0}Show Test Configuration</button>{1}</div><a title=\"Help\" class=\"help\" href=\"https://github.com/Unity-Technologies/PerformanceBenchmarkReporter/wiki\" target=\"_blank\"><div class=\"helpwrapper\"></div></a>",
metadataValidator.MismatchesExist
? "<image class=\"warning\" src=\"warning.png\"></img>"
: string.Empty,
@ -248,7 +249,7 @@ namespace UnityPerformanceBenchmarkReporter.Report
var resultColors = new StringBuilder();
resultColors.Append(" backgroundColor: [");
foreach (var testResult in resultsForThisTest)
foreach (var testResult in resultsForThisTest)
{
if (testResult.SampleGroupResults.Any(r =>
ScrubStringForSafeForVariableUse(r.SampleGroupName).Equals(distinctSampleGroupName)))
@ -272,20 +273,22 @@ namespace UnityPerformanceBenchmarkReporter.Report
rw.WriteLine(" borderWidth: 1,");
rw.WriteLine(" label: \"" + (sampleUnit.Equals("None") ? distinctSampleGroupName : sampleUnit) + "\",");
rw.WriteLine(" legend: {");
rw.WriteLine("display: false,");
rw.WriteLine("display: true,");
rw.WriteLine(" },");
rw.WriteLine(" data: {0}", string.Format("{0}_Aggregated_Values", canvasId));
rw.WriteLine(" }");
if (baselineResults != null)
{
rw.WriteLine(" ,{");
rw.WriteLine(" borderColor: baselineColor,");
rw.WriteLine(" backgroundColor: baselineColor,");
rw.WriteLine(" borderWidth: 2,");
rw.WriteLine(" fill: false,");
rw.WriteLine(" pointStyle: 'line',");
rw.WriteLine(" label: \"" + (sampleUnit.Equals("None") ? "Baseline " + distinctSampleGroupName : "Baseline " + sampleUnit) + "\",");
rw.WriteLine(" legend: {");
rw.WriteLine("display: false,");
rw.WriteLine("display: true,");
rw.WriteLine(" },");
rw.WriteLine(" data: {0}", string.Format("{0}_Baseline_Values,", canvasId));
rw.WriteLine(" type: 'line'}");
@ -361,25 +364,28 @@ namespace UnityPerformanceBenchmarkReporter.Report
var threshold = GetThreshold(resultsForThisTest, distinctSampleGroupName);
var sampleCount = GetSampleCount(resultsForThisTest, distinctSampleGroupName);
var canvasId = GetCanvasId(distinctTestName, distinctSampleGroupName);
rw.WriteLine("Chart.defaults.global.elements.rectangle.borderColor = \'#fff\';");
rw.WriteLine(" var ctx{0} = document.getElementById('{0}').getContext('2d');", canvasId);
rw.WriteLine(" window.{0} = new Chart(ctx{0}, {{", canvasId);
rw.WriteLine(" type: 'bar',");
rw.WriteLine(" data: {0}_data,", canvasId);
rw.WriteLine(" options: {");
rw.WriteLine("var ctx{0} = document.getElementById('{0}').getContext('2d');", canvasId);
rw.WriteLine("window.{0} = new Chart(ctx{0}, {{", canvasId);
rw.WriteLine("type: 'bar',");
rw.WriteLine("data: {0}_data,", canvasId);
rw.WriteLine("options: {");
rw.WriteLine("tooltips:");
rw.WriteLine("{");
rw.WriteLine(" mode: 'index',");
rw.WriteLine(" callbacks:");
rw.WriteLine(" {");
rw.WriteLine(" footer: function(tooltipItems, data) {");
rw.WriteLine(" var std = {0}_Stdev_Values[tooltipItems[0].index];", canvasId);
rw.WriteLine(" return 'Threshold: {0} Standard deviation: ' + std + ' Sample count: {1}';", threshold, sampleCount);
rw.WriteLine(" },");
rw.WriteLine(" },");
rw.WriteLine(" footerFontStyle: 'normal'");
rw.WriteLine("mode: 'index',");
rw.WriteLine("callbacks: {");
rw.WriteLine("title: function(tooltipItems, data) {");
rw.WriteLine("var color = {0}_data.datasets[0].backgroundColor[tooltipItems[0].index];", canvasId);
rw.WriteLine("return tooltipItems[0].xLabel + (color === failColor ? \" regressed\" : \" within threshold\");},");
rw.WriteLine("beforeFooter: function(tooltipItems, data) {");
rw.WriteLine("var std = {0}_Stdev_Values[tooltipItems[0].index];", canvasId);
rw.WriteLine("var footermsg = ['Threshold: {0}']; footermsg.push('Standard deviation: ' + std); footermsg.push('Sample count: {1}'); return footermsg;}},", threshold, sampleCount);
rw.WriteLine("},");
rw.WriteLine("legend: { display: false},");
rw.WriteLine("footerFontStyle: 'normal'");
rw.WriteLine("},");
rw.WriteLine("legend: { display: true},");
rw.WriteLine("maintainAspectRatio: false,");
rw.WriteLine("scales: {");
rw.WriteLine(" yAxes: [{");
@ -393,13 +399,21 @@ namespace UnityPerformanceBenchmarkReporter.Report
rw.WriteLine("suggestedMax: .001,");
rw.WriteLine("suggestedMin: .0");
rw.WriteLine(" }");
rw.WriteLine(" }],");
rw.WriteLine(" xAxes: [{");
rw.WriteLine(" display: true,");
rw.WriteLine(" scaleLabel:");
rw.WriteLine(" {");
rw.WriteLine(" display: true,");
rw.WriteLine(" labelString: \"Result File\"");
rw.WriteLine(" }");
rw.WriteLine(" }]");
rw.WriteLine("},");
rw.WriteLine("responsive: true,");
rw.WriteLine("responsiveAnimationDuration: 0,");
rw.WriteLine("title: {");
rw.WriteLine(" display: true,");
rw.WriteLine(" text: \"{0}\"", distinctSampleGroupName);
rw.WriteLine(" text: \"{0} Sample Group\"", distinctSampleGroupName);
rw.WriteLine("}");
rw.WriteLine(" }");
rw.WriteLine(" });");
@ -414,11 +428,11 @@ namespace UnityPerformanceBenchmarkReporter.Report
rw.WriteLine(" var img = t.childNodes[0];");
rw.WriteLine(" if (x.style.display === \"\" || x.style.display === \"none\") {");
rw.WriteLine(" x.style.display = \"block\";");
rw.WriteLine(" document.getElementById(\"toggleconfig\").innerHTML= img.outerHTML + \"Hide Test Configuration\";");
rw.WriteLine(" document.getElementById(\"toggleconfig\").innerHTML= (img.outerHTML || \"\") + \"Hide Test Configuration\";");
rw.WriteLine(" } else {");
rw.WriteLine(" x.style.display = \"none\";");
rw.WriteLine(" var img = t.childNodes[0];");
rw.WriteLine(" document.getElementById(\"toggleconfig\").innerHTML= img.outerHTML + \"Show Test Configuration\";");
rw.WriteLine(" document.getElementById(\"toggleconfig\").innerHTML= (img.outerHTML || \"\") + \"Show Test Configuration\";");
rw.WriteLine(" }");
rw.WriteLine("}");
}
@ -478,15 +492,12 @@ namespace UnityPerformanceBenchmarkReporter.Report
{
var resultsForThisTest = GetResultsForThisTest(distinctTestName);
var noTestRegressions = IsNoTestFailures(resultsForThisTest);
rw.WriteLine(noTestRegressions ? "<tr class=\"nofailures\"><td><hr></td></tr>" : "<tr><td><hr></td></tr>");
rw.WriteLine(noTestRegressions ? "<tr class=\"nofailures\">" : "<tr>");
rw.WriteLine("<td class=\"testnamecell chartcell\">");
rw.WriteLine(
noTestRegressions
? "<div class=\"testname nofailures\"><h3>{0}</h3> </div>"
: "<div class=\"testname\"><h3>{0}</h3> </div>", distinctTestName);
rw.WriteLine("</td></tr>");
rw.WriteLine(noTestRegressions ? "<tr class=\"nofailures\"><td><hr></td></tr>" : "<tr><td><hr></td></tr>");
//rw.WriteLine(noTestRegressions ? "<tr class=\"nofailures\"><td></td></tr>" : "<tr><td></td></tr>");
rw.WriteLine("<tr {0}>", noTestRegressions ? "class=\"nofailures\"" : string.Empty);
rw.WriteLine("<td class=\"testnamecell\"><div class=\"testname {0}\"><h5><p>Test Name:</p></h5><h3><p>{1}</p></h3></div></td></tr>",
noTestRegressions ? "nofailures" : string.Empty,
distinctTestName);
rw.WriteLine(noTestRegressions ? "<tr class=\"nofailures\"><td></td></tr>" : "<tr><td></td></tr>");
foreach (var distinctSampleGroupName in distinctSampleGroupNames)
{
@ -730,7 +741,7 @@ namespace UnityPerformanceBenchmarkReporter.Report
var path = string.Join('\\', pathParts.Take(pathParts.Length - 1));
sb.Append(string.Format("<tr title={4}><td {0}>{1}</td><td {0}>{2}</td><td {0}>{3}</td></tr>", value.Equals(baselineValue) ? "class=\"targetvalue\"" : string.Empty, value, pathParts[pathParts.Length - 1], path, value.Equals(baselineValue) ? "\"Baseline configuration\"" : "\"Mismatched configuration\""));
sb.Append(string.Format("<tr><td {0} title={4}>{1}</td><td {0}>{2}</td><td {0}>{3}</td></tr>", value.Equals(baselineValue) ? "class=\"targetvalue\"" : string.Empty, value, pathParts[pathParts.Length - 1], path, i == 0 ? "\"Configuration used for comparison\"" : value.Equals(baselineValue) ? "\"Matching configuration\"" : "\"Mismatched configuration\""));
}
sb.Append("</table></div>");

Двоичные данные
UnityPerformanceBenchmarkReporter/Report/help-hover.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.7 KiB

Двоичные данные
UnityPerformanceBenchmarkReporter/Report/help.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 6.2 KiB

Просмотреть файл

@ -12,15 +12,49 @@ h3 {
overflow-wrap: break-word;
}
h5 {
font-size: 1vh;
overflow-wrap: break-word;
}
p {
line-height: 25%
}
th {
border-bottom-style: solid;
border-bottom-color: lightgray;
}
.targetvalue {
color: black !important;
color: black;
}
.help {
width: 100%;
}
.toggleconfigwrapper {
display: inline-flex;
align-items: flex-start;
width: 100%;
}
.helpwrapper {
display: inline;
background-image: url("help.png");
height: 4vh;
width: 4vh;
background-repeat: no-repeat;
float: right;
background-size: 100%;
padding: 10px;
}
.helpwrapper:hover {
background-image: url("help2.png");
}
.titletable {
height: 80%;
width: 100%;
@ -70,6 +104,7 @@ th {
.testnamecell {
background-color: lightgray;
padding: 0px 5px 0px 5px;
}
.testname {
@ -82,10 +117,10 @@ th {
border: none;
color: white;
padding: 15px 25px;
text-align: center;
cursor: pointer;
border-radius: 4px;
font-weight: bold;
margin: 5px 5px 5px 0px;
}
.button {
@ -94,23 +129,25 @@ th {
border: none;
color: white;
padding: 15px 25px;
text-align: center;
cursor: pointer;
border-radius: 4px;
font-weight: bold;
margin: 5px 5px 5px 0px;
}
div > .configwarning {
font-size: 1.25vh;
font-weight: bold;
visibility: hidden;
width: 120px;
background-color: #f28034;
color: white;
text-align: center;
border-radius: 6px;
text-align: left;
border-radius: 4px;
z-index: 1;
top: -5px;
left: 105%;
padding: 5px 5px 5px 5px;
padding: 10px 5px 5px 5px;
font-family: 'Arial', 'Helvetica', 'Helvetica Neue', sans-serif;
margin: 5px;
}
@ -124,6 +161,10 @@ div:hover > .configwarning {
background-color: #2196F3 !important;
}
.flex {
display: flex;
}
.buttondiv {
display: inline;
}
@ -141,6 +182,9 @@ div:hover > .configwarning {
.showedfailedtests {
padding: 5px 5px 5px 0px;
display: inline-flex;
align-items: flex-start;
width: 100%;
}
@ -193,7 +237,7 @@ div:hover > .configwarning {
font-size: 1.25vh;
overflow-wrap: break-word;
font-family: 'Arial', 'Helvetica', 'Helvetica Neue', sans-serif;
margin: 4px;
padding: 4px;
}
.fieldnamewarning {
@ -203,12 +247,12 @@ div:hover > .configwarning {
font-size: 1.25vh;
overflow-wrap: break-word;
font-family: 'Arial', 'Helvetica', 'Helvetica Neue', sans-serif;
margin: 4px;
padding: 4px;
}
.fieldvalue {
font-size: 1.1vh;
margin: 4px;
padding: 0px 4px 4px 4px;
}
.fieldvaluewarning {
@ -310,13 +354,13 @@ pre {
}
.disabledContainerLabel {
font-size: 1.25vh important !;
display: block;
font-weight: bold;
position: relative;
padding-left: 35px;
margin-bottom: 12px;
cursor: pointer;
font-size: medium;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
@ -332,18 +376,20 @@ pre {
}
.disabledContainerLabel .tooltiptext {
font-size: 1.25vh;
visibility: hidden;
width: 120px;
background-color: #2196F3;
color: #fff;
text-align: center;
border-radius: 6px;
text-align: left;
border-radius: 4px;
padding: 5px 0;
z-index: 1;
top: -5px;
left: 105%;
padding: 5px 5px 5px 5px;
padding: 10px 5px 5px 5px;
font-family: 'Arial', 'Helvetica', 'Helvetica Neue', sans-serif;
margin: 5px;
}
.disabledContainerLabel:hover .tooltiptext {
@ -365,6 +411,9 @@ pre {
.chartcell {
padding: 5px 5px 5px 10px;
border-width: 2px 0px 0px 0px;
border-style: solid;
border-color: darkgray;
}
.container {

Просмотреть файл

@ -23,6 +23,8 @@
<EmbeddedResource Include="Report\styles.css" />
<EmbeddedResource Include="Report\UnityLogo.png" />
<EmbeddedResource Include="Report\warning.png" />
<EmbeddedResource Include="Report\help.png" />
<EmbeddedResource Include="Report\help-hover.png" />
</ItemGroup>
</Project>