Title: [233147] trunk/PerformanceTests
Revision
233147
Author
jon...@apple.com
Date
2018-06-25 08:38:03 -0700 (Mon, 25 Jun 2018)

Log Message

[MotionMark] Add support for version numbers
https://bugs.webkit.org/show_bug.cgi?id=186479

Reviewed by Said Abou-Hallawa.

Add support for displaying the version number as well as including it in the JSON results.

When loading the front page, script replaces any element with classname version with the
version number of the benchmark, which is stored in Strings.version.

The JSON structure for the results includes a new version property:
    {
      "version": "1.0",
      "options": { ... },
      "data": [ ... ]
    }

When dragging a results file, the version listed will come from the JSON file. Older
results will not have had the version property, in which case it will default to "1.0".

* MotionMark/index.html: Update title to some other default. Script will update it.
Include the version number in the logo title.
* MotionMark/developer.html: Ditto.
* MotionMark/about.html: Ditto.

* MotionMark/resources/runner/motionmark.js:
(ResultsDashboard): Update constructor to include version. This is used when serializing
results out to JSON, and displaying the results panel in developer mode.
(ResultsDashboard._processData): When running the benchmark, include benchmark version string
in the results object.
(ResultsDashboard.version):
(window.benchmarkRunnerClient.willStartFirstIteration): When running the benchmark, pass the
benchmark version string to the dashboard, which holds the results.
(window.sectionsManager.setSectionVersion): Helper function to update the element in the
section with the class name version.
(window.benchmarkController.initialize): Populate all DOM elements with class name "version"
with the version string. Update the page title.
(window.benchmarkController.showResults): When showing results, update the version string
based on what is included in the JSON results, which would be the same as the benchmark version.
* MotionMark/resources/runner/motionmark.css: Include missing copyright. Wrap the SVG logo
in a div and include the version string.
* MotionMark/resources/strings.js: Add strings for the page title template, and the version.

* MotionMark/resources/debug-runner/motionmark.css:
* MotionMark/resources/debug-runner/motionmark.js:
(window.benchmarkRunnerClient.willStartFirstIteration): When running the benchmark, pass the
benchmark version string to the dashboard, which holds the results.
(window.benchmarkController.initialize): Populate all DOM elements with class name "version"
with the version string. Update the page title. When dragging in JSON results, look for
version to pass to the dashboard. If it doesn't exist, default to "1.0".
(window.benchmarkController.showResults): When showing results, update the version string
based on what is included in the JSON results, instead of the current benchmark version.
* MotionMark/resources/debug-runner/tests.js: Update page title template.

Modified Paths

Diff

Modified: trunk/PerformanceTests/ChangeLog (233146 => 233147)


--- trunk/PerformanceTests/ChangeLog	2018-06-25 15:15:03 UTC (rev 233146)
+++ trunk/PerformanceTests/ChangeLog	2018-06-25 15:38:03 UTC (rev 233147)
@@ -1,3 +1,59 @@
+2018-06-25  Jon Lee  <jon...@apple.com>
+
+        [MotionMark] Add support for version numbers
+        https://bugs.webkit.org/show_bug.cgi?id=186479
+
+        Reviewed by Said Abou-Hallawa.
+
+        Add support for displaying the version number as well as including it in the JSON results.
+
+        When loading the front page, script replaces any element with classname version with the
+        version number of the benchmark, which is stored in Strings.version.
+
+        The JSON structure for the results includes a new version property:
+            {
+              "version": "1.0",
+              "options": { ... },
+              "data": [ ... ]
+            }
+
+        When dragging a results file, the version listed will come from the JSON file. Older
+        results will not have had the version property, in which case it will default to "1.0".
+
+        * MotionMark/index.html: Update title to some other default. Script will update it.
+        Include the version number in the logo title.
+        * MotionMark/developer.html: Ditto.
+        * MotionMark/about.html: Ditto.
+
+        * MotionMark/resources/runner/motionmark.js:
+        (ResultsDashboard): Update constructor to include version. This is used when serializing
+        results out to JSON, and displaying the results panel in developer mode.
+        (ResultsDashboard._processData): When running the benchmark, include benchmark version string
+        in the results object.
+        (ResultsDashboard.version):
+        (window.benchmarkRunnerClient.willStartFirstIteration): When running the benchmark, pass the
+        benchmark version string to the dashboard, which holds the results.
+        (window.sectionsManager.setSectionVersion): Helper function to update the element in the
+        section with the class name version.
+        (window.benchmarkController.initialize): Populate all DOM elements with class name "version"
+        with the version string. Update the page title.
+        (window.benchmarkController.showResults): When showing results, update the version string
+        based on what is included in the JSON results, which would be the same as the benchmark version.
+        * MotionMark/resources/runner/motionmark.css: Include missing copyright. Wrap the SVG logo
+        in a div and include the version string.
+        * MotionMark/resources/strings.js: Add strings for the page title template, and the version.
+
+        * MotionMark/resources/debug-runner/motionmark.css:
+        * MotionMark/resources/debug-runner/motionmark.js:
+        (window.benchmarkRunnerClient.willStartFirstIteration): When running the benchmark, pass the
+        benchmark version string to the dashboard, which holds the results.
+        (window.benchmarkController.initialize): Populate all DOM elements with class name "version"
+        with the version string. Update the page title. When dragging in JSON results, look for
+        version to pass to the dashboard. If it doesn't exist, default to "1.0".
+        (window.benchmarkController.showResults): When showing results, update the version string
+        based on what is included in the JSON results, instead of the current benchmark version.
+        * MotionMark/resources/debug-runner/tests.js: Update page title template.
+
 2018-06-08  Jon Lee  <jon...@apple.com>
 
         [MotionMark] Rename Suits test files

Modified: trunk/PerformanceTests/MotionMark/about.html (233146 => 233147)


--- trunk/PerformanceTests/MotionMark/about.html	2018-06-25 15:15:03 UTC (rev 233146)
+++ trunk/PerformanceTests/MotionMark/about.html	2018-06-25 15:38:03 UTC (rev 233147)
@@ -1,5 +1,5 @@
 <!--
-  Copyright (C) 2015-2017 Apple Inc. All rights reserved.
+  Copyright (C) 2015-2018 Apple Inc. All rights reserved.
 
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
@@ -31,14 +31,16 @@
     <title>About MotionMark</title>
 
     <link rel="stylesheet" href=""
+
+    <script src=""
 </head>
 <body class="images-loaded">
     <main>
     <section id="about" class="selected">
-        <svg class="logo"><use xlink:href=""
+        <div class="logo"><svg><use xlink:href="" /></svg></div>
 
         <div class="body">
-            <h1>About MotionMark</h1>
+            <h1>About MotionMark <span class="version"></span></h1>
 
             <p>MotionMark is a web benchmark that focuses on graphics performance. It draws multiple rendering elements, each of which uses the same set of graphics primitives. An element could be an SVG node, an HTML element with CSS style, or a series of canvas operations. Slight variations among the elements avoid trivial caching optimizations by the browser. Although fairly simple, the effects were chosen to reflect techniques commonly used on the web. Tests are visually rich, being designed to stress the graphics system rather than _javascript_.</p>
 
@@ -72,5 +74,10 @@
         </div>
         </section>
     </main>
+
+    <script>
+        document.title = "About MotionMark " + Strings.version;
+        document.querySelector(".version").textContent = Strings.version;
+    </script>
 </body>
 </html>
\ No newline at end of file

Modified: trunk/PerformanceTests/MotionMark/developer.html (233146 => 233147)


--- trunk/PerformanceTests/MotionMark/developer.html	2018-06-25 15:15:03 UTC (rev 233146)
+++ trunk/PerformanceTests/MotionMark/developer.html	2018-06-25 15:38:03 UTC (rev 233147)
@@ -28,7 +28,7 @@
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, user-scalable=no">
 
-    <title>MotionMark 1.0 - developer</title>
+    <title>MotionMark developer</title>
 
     <link rel="stylesheet" href=""
     <link rel="stylesheet" href=""
@@ -49,7 +49,10 @@
 <body class="showing-intro">
     <main>
         <section id="intro" class="selected">
-            <h1>MotionMark</h1>
+            <header>
+                <h1>MotionMark</h1>
+                <h2>version <span class="version"></span></h2>
+            </header>
             <div class="body">
                 <div>
                     <div id="suites">
@@ -131,6 +134,7 @@
                     <span class="medium">on a medium screen (laptop, tablet)</span>
                     <span class="large">on a large screen (desktop)</span>
                 </div>
+                <div>version <span class="version"></span></div>
                 <p class="score" _onclick_="benchmarkController.showDebugInfo()"></p>
                 <p class="confidence"></p>
                 <div id="results-tables" class="table-container">

Modified: trunk/PerformanceTests/MotionMark/index.html (233146 => 233147)


--- trunk/PerformanceTests/MotionMark/index.html	2018-06-25 15:15:03 UTC (rev 233146)
+++ trunk/PerformanceTests/MotionMark/index.html	2018-06-25 15:38:03 UTC (rev 233147)
@@ -1,5 +1,5 @@
 <!--
-  Copyright (C) 2015-2017 Apple Inc. All rights reserved.
+  Copyright (C) 2015-2018 Apple Inc. All rights reserved.
 
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
@@ -28,7 +28,7 @@
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, user-scalable=no">
 
-    <title>MotionMark 1.0</title>
+    <title>MotionMark</title>
 
     <link rel="stylesheet" href=""
 
@@ -51,7 +51,10 @@
 <body class="showing-intro">
     <main>
         <section id="intro" class="selected">
-            <svg class="logo"><use xlink:href=""
+            <div class="logo">
+              <svg><use xlink:href="" /></svg>
+              <div>version <span class="version"></span></div>
+            </div>
             <div class="body">
                 <p>MotionMark is a graphics benchmark that measures a browser’s capability to animate complex scenes at a target frame rate.</p>
 
@@ -65,7 +68,10 @@
         <section id="test-container" class="frame-container"></section>
 
         <section id="results">
-            <svg class="logo"><use xlink:href=""
+            <div class="logo">
+              <svg><use xlink:href="" /></svg>
+              <div>version <span class="version"></span></div>
+            </div>
             <div class="body">
                 <div class="score-container">
                     <div class="score"></div>

Modified: trunk/PerformanceTests/MotionMark/resources/debug-runner/motionmark.css (233146 => 233147)


--- trunk/PerformanceTests/MotionMark/resources/debug-runner/motionmark.css	2018-06-25 15:15:03 UTC (rev 233146)
+++ trunk/PerformanceTests/MotionMark/resources/debug-runner/motionmark.css	2018-06-25 15:38:03 UTC (rev 233147)
@@ -45,12 +45,16 @@
     transform: none;
 }
 
-h1 {
-    font-size: 3em;
-    margin: 1.5em 0 .5em;
+header {
+    margin: 3em 0 1em;
     text-align: center;
 }
 
+header h1, header h2 {
+    font-size: 3em;
+    margin: 0;
+}
+
 button {
     transform: none !important;
     min-width: initial;
@@ -84,8 +88,8 @@
 
 @media screen and (max-device-width: 414px),
     screen and (max-device-height: 414px) and (orientation: landscape) {
-    h1 {
-        font-size: 2.5em;
+    header h1 {
+        font-size: 2em;
     }
 
     section {

Modified: trunk/PerformanceTests/MotionMark/resources/debug-runner/motionmark.js (233146 => 233147)


--- trunk/PerformanceTests/MotionMark/resources/debug-runner/motionmark.js	2018-06-25 15:15:03 UTC (rev 233146)
+++ trunk/PerformanceTests/MotionMark/resources/debug-runner/motionmark.js	2018-06-25 15:38:03 UTC (rev 233147)
@@ -134,7 +134,7 @@
 
     willStartFirstIteration: function()
     {
-        this.results = new ResultsDashboard(this.options);
+        this.results = new ResultsDashboard(Strings.version, this.options);
         this.progressBar = new ProgressBar(document.getElementById("progress-completed"), this.testsCount);
     },
 
@@ -532,6 +532,11 @@
 Utilities.extendObject(window.benchmarkController, {
     initialize: function()
     {
+        document.title = Strings.text.title.replace("%s", Strings.version);
+        document.querySelectorAll(".version").forEach(function(e) {
+            e.textContent = Strings.version;
+        });
+
         document.forms["benchmark-options"].addEventListener("change", benchmarkController.onBenchmarkOptionsChanged, true);
         document.forms["graph-type"].addEventListener("change", benchmarkController.onGraphTypeChanged, true);
         document.forms["time-graph-options"].addEventListener("change", benchmarkController.onTimeGraphOptionsChanged, true);
@@ -571,7 +576,9 @@
                 var run = JSON.parse(e.target.result);
                 if (run.debugOutput instanceof Array)
                     run = run.debugOutput[0];
-                benchmarkRunnerClient.results = new ResultsDashboard(run.options, run.data);
+                if (!("version" in run))
+                    run.version = "1.0";
+                benchmarkRunnerClient.results = new ResultsDashboard(run.version, run.options, run.data);
                 benchmarkController.showResults();
             };
 
@@ -657,6 +664,7 @@
         var score = dashboard.score;
         var confidence = ((dashboard.scoreLowerBound / score - 1) * 100).toFixed(2) +
             "% / +" + ((dashboard.scoreUpperBound / score - 1) * 100).toFixed(2) + "%";
+        sectionsManager.setSectionVersion("results", dashboard.version);
         sectionsManager.setSectionScore("results", score.toFixed(2), confidence);
         sectionsManager.populateTable("results-header", Headers.testName, dashboard);
         sectionsManager.populateTable("results-score", Headers.score, dashboard);

Modified: trunk/PerformanceTests/MotionMark/resources/debug-runner/tests.js (233146 => 233147)


--- trunk/PerformanceTests/MotionMark/resources/debug-runner/tests.js	2018-06-25 15:15:03 UTC (rev 233146)
+++ trunk/PerformanceTests/MotionMark/resources/debug-runner/tests.js	2018-06-25 15:38:03 UTC (rev 233147)
@@ -28,7 +28,8 @@
     frameRate: "FPS",
     confidenceInterval: "80% Confidence Interval",
     mergedRawComplexity: "Raw Complexity",
-    graph: "Graph"
+    graph: "Graph",
+    title: "MotionMark %s developer",
 });
 
 

Modified: trunk/PerformanceTests/MotionMark/resources/runner/motionmark.css (233146 => 233147)


--- trunk/PerformanceTests/MotionMark/resources/runner/motionmark.css	2018-06-25 15:15:03 UTC (rev 233146)
+++ trunk/PerformanceTests/MotionMark/resources/runner/motionmark.css	2018-06-25 15:38:03 UTC (rev 233147)
@@ -1,5 +1,28 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
 /* Outer harness */
-
 html,
 body {
     min-height: 100%;
@@ -72,14 +95,16 @@
     display: block;
 }
 
-svg.logo {
+.logo {
+    position: relative;
+}
+
+.logo svg {
     width: 350px;
     height: 88px;
 
     max-width: 100%;
 
-    padding-bottom: 1em;
-
     color: hsl(35, 100%, 50%);
 
     animation: foreground-color 60s linear infinite 2s;
@@ -88,19 +113,32 @@
     will-change: color;
 }
 
-body.images-loaded svg.logo {
+.logo div {
+    transform: skewX(-10deg);
+    margin-left: 1em;
+}
+
+body.images-loaded .logo svg {
     animation-play-state: running;
 }
 
 @media screen and (min-width: 667px) {
-    svg.logo {
+    .logo svg {
         width: 525px;
         height: 130px;
+        padding-left: .4em;
     }
+
+    .logo div {
+        position: absolute;
+        left: 360px;
+        bottom: 0.2em;
+        font-size: 75%;
+    }
 }
 
 section .body {
-    margin: 0 1em;
+    margin: 2em 1em 0;
     max-width: 350px;
 }
 

Modified: trunk/PerformanceTests/MotionMark/resources/runner/motionmark.js (233146 => 233147)


--- trunk/PerformanceTests/MotionMark/resources/runner/motionmark.js	2018-06-25 15:15:03 UTC (rev 233146)
+++ trunk/PerformanceTests/MotionMark/resources/runner/motionmark.js	2018-06-25 15:38:03 UTC (rev 233147)
@@ -23,11 +23,12 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
  ResultsDashboard = Utilities.createClass(
-    function(options, testData)
+    function(version, options, testData)
     {
         this._iterationsSamplers = [];
         this._options = options;
         this._results = null;
+        this._version = version;
         if (testData) {
             this._iterationsSamplers = testData;
             this._processData();
@@ -81,6 +82,7 @@
             iterationsScores.push(result[Strings.json.score]);
         }, this);
 
+        this._results[Strings.json.version] = this._version;
         this._results[Strings.json.score] = Statistics.sampleMean(iterationsScores.length, iterationsScores.reduce(function(a, b) { return a + b; }));
         this._results[Strings.json.scoreLowerBound] = this._results[Strings.json.results.iterations][0][Strings.json.scoreLowerBound];
         this._results[Strings.json.scoreUpperBound] = this._results[Strings.json.results.iterations][0][Strings.json.scoreUpperBound];
@@ -250,6 +252,11 @@
         return this._options;
     },
 
+    get version()
+    {
+        return this._version;
+    },
+
     _getResultsProperty: function(property)
     {
         if (this._results)
@@ -388,7 +395,7 @@
 
     willStartFirstIteration: function()
     {
-        this.results = new ResultsDashboard(this.options);
+        this.results = new ResultsDashboard(Strings.version, this.options);
     },
 
     didRunSuites: function(suitesSamplers)
@@ -430,6 +437,11 @@
             history.pushState({section: sectionIdentifier}, document.title);
     },
 
+    setSectionVersion: function(sectionIdentifier, version)
+    {
+        document.querySelector("#" + sectionIdentifier + " .version").textContent = version;
+    },
+
     setSectionScore: function(sectionIdentifier, score, confidence)
     {
         document.querySelector("#" + sectionIdentifier + " .score").textContent = score;
@@ -447,6 +459,10 @@
 window.benchmarkController = {
     initialize: function()
     {
+        document.title = Strings.text.title.replace("%s", Strings.version);
+        document.querySelectorAll(".version").forEach(function(e) {
+            e.textContent = Strings.version;
+        });
         benchmarkController.addOrientationListenerIfNecessary();
     },
 
@@ -536,6 +552,7 @@
         var dashboard = benchmarkRunnerClient.results;
         var score = dashboard.score;
         var confidence = "±" + (Statistics.largestDeviationPercentage(dashboard.scoreLowerBound, score, dashboard.scoreUpperBound) * 100).toFixed(2) + "%";
+        sectionsManager.setSectionVersion("results", dashboard.version);
         sectionsManager.setSectionScore("results", score.toFixed(2), confidence);
         sectionsManager.populateTable("results-header", Headers.testName, dashboard);
         sectionsManager.populateTable("results-score", Headers.score, dashboard);
@@ -584,6 +601,7 @@
         data.textContent = "Please wait...";
         setTimeout(function() {
             var output = {
+                version: benchmarkRunnerClient.results.version,
                 options: benchmarkRunnerClient.results.options,
                 data: benchmarkRunnerClient.results.data
             };

Modified: trunk/PerformanceTests/MotionMark/resources/strings.js (233146 => 233147)


--- trunk/PerformanceTests/MotionMark/resources/strings.js	2018-06-25 15:15:03 UTC (rev 233146)
+++ trunk/PerformanceTests/MotionMark/resources/strings.js	2018-06-25 15:38:03 UTC (rev 233147)
@@ -23,11 +23,15 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 var Strings = {
+    version: "1.0",
     text: {
         testName: "Test Name",
-        score: "Score"
+        score: "Score",
+        title: "MotionMark %s",
     },
     json: {
+        version: "version",
+
         marks: "marks",
         samplingStartTimeOffset: "Start sampling",
         samplingEndTimeOffset: "End sampling",
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to