Title: [196291] trunk/PerformanceTests
Revision
196291
Author
jon...@apple.com
Date
2016-02-08 19:30:26 -0800 (Mon, 08 Feb 2016)

Log Message

Add option to use different methods for retrieving a timestamp.

* Animometer/developer.html: Add performance.now and Date.now options.
* Animometer/resources/runner/animometer.js: Default to performance.now.
(window.benchmarkController.startBenchmark):
* Animometer/tests/resources/main.js: Tie the desired method to _getTimestamp.
(run): Use _getTimestamp.
(_animateLoop): Ditto.

Modified Paths

Diff

Modified: trunk/PerformanceTests/Animometer/developer.html (196290 => 196291)


--- trunk/PerformanceTests/Animometer/developer.html	2016-02-09 03:30:23 UTC (rev 196290)
+++ trunk/PerformanceTests/Animometer/developer.html	2016-02-09 03:30:26 UTC (rev 196291)
@@ -58,6 +58,13 @@
                             <li><label>Measurement error (R): <input type="number" id="kalman-measurement-error" value="4"></label></li>
                         </ul>
                     </li>
+                    <li>
+                        <h3>Time measurement method:</h3>
+                        <ul>
+                            <li><label><input name="time-measurement" type="radio" value="performance" checked> <code>performance.now()</code></label></li>
+                            <li><label><input name="time-measurement" type="radio" value="date"> <code>Date.now()</code></label></li>
+                        </ul>
+                    </li>
                     </ul>
                     </form>
                 </div>

Modified: trunk/PerformanceTests/Animometer/resources/runner/animometer.js (196290 => 196291)


--- trunk/PerformanceTests/Animometer/resources/runner/animometer.js	2016-02-09 03:30:23 UTC (rev 196290)
+++ trunk/PerformanceTests/Animometer/resources/runner/animometer.js	2016-02-09 03:30:26 UTC (rev 196291)
@@ -308,7 +308,8 @@
             "adjustment": "adaptive",
             "frame-rate": 50,
             "kalman-process-error": 1,
-            "kalman-measurement-error": 4
+            "kalman-measurement-error": 4,
+            "time-measurement": "performance"
         };
         this._startBenchmark(Suites, options, "test-container");
     },

Modified: trunk/PerformanceTests/Animometer/tests/resources/main.js (196290 => 196291)


--- trunk/PerformanceTests/Animometer/tests/resources/main.js	2016-02-09 03:30:23 UTC (rev 196290)
+++ trunk/PerformanceTests/Animometer/tests/resources/main.js	2016-02-09 03:30:26 UTC (rev 196291)
@@ -329,6 +329,16 @@
         this._stage = stage;
         this._stage.initialize(this, options);
 
+        switch (options["time-measurement"])
+        {
+        case "performance":
+            this._getTimestamp = performance.now.bind(performance);
+            break;
+        case "date":
+            this._getTimestamp = Date.now;
+            break;
+        }
+
         var testIntervalMilliseconds = options["test-interval"] * 1000;
         switch (options["adjustment"])
         {
@@ -351,7 +361,7 @@
     {
         return this.waitUntilReady().then(function() {
             this._finishPromise = new SimplePromise;
-            this._previousTimestamp = performance.now();
+            this._previousTimestamp = this._getTimestamp();
             this._didWarmUp = false;
             this._stage.tune(this._controller.initialComplexity - this._stage.complexity());
             this._animateLoop();
@@ -369,7 +379,7 @@
 
     _animateLoop: function()
     {
-        this._currentTimestamp = performance.now();
+        this._currentTimestamp = this._getTimestamp();
 
         if (!this._didWarmUp) {
             if (this._currentTimestamp - this._previousTimestamp >= 100) {

Modified: trunk/PerformanceTests/ChangeLog (196290 => 196291)


--- trunk/PerformanceTests/ChangeLog	2016-02-09 03:30:23 UTC (rev 196290)
+++ trunk/PerformanceTests/ChangeLog	2016-02-09 03:30:26 UTC (rev 196291)
@@ -1,5 +1,16 @@
 2016-02-07  Jon Lee  <jon...@apple.com>
 
+        Add option to use different methods for retrieving a timestamp.
+
+        * Animometer/developer.html: Add performance.now and Date.now options.
+        * Animometer/resources/runner/animometer.js: Default to performance.now.
+        (window.benchmarkController.startBenchmark):
+        * Animometer/tests/resources/main.js: Tie the desired method to _getTimestamp.
+        (run): Use _getTimestamp.
+        (_animateLoop): Ditto.
+
+2016-02-07  Jon Lee  <jon...@apple.com>
+
         Allow adding any number of markers to the graph. The markers can be labeled
         and contain timestamp and sample index data. Make it a part of the controller
         rather than keeping it in the sampler.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to