Bug 1374333 - Use TalosContentProfiler to fix profiling in glterrain tests. r?rwood draft
authorMike Conley <mconley@mozilla.com>
Tue, 11 Jul 2017 17:22:14 -0400
changeset 610832 64cadf0d1d5234f8ce9357fe2be49493565ded5e
parent 610831 f17270402b70358d405639fe10790075592e3d63
child 610833 40a5ea92819b1753fcc7a5d05d66658760a46e05
push id69002
push usermconley@mozilla.com
push dateTue, 18 Jul 2017 19:11:35 +0000
reviewersrwood
bugs1374333
milestone56.0a1
Bug 1374333 - Use TalosContentProfiler to fix profiling in glterrain tests. r?rwood MozReview-Commit-ID: FQl58ZNyFCl
testing/talos/talos/tests/webgl/benchmarks/terrain/perftest.html
--- a/testing/talos/talos/tests/webgl/benchmarks/terrain/perftest.html
+++ b/testing/talos/talos/tests/webgl/benchmarks/terrain/perftest.html
@@ -8,17 +8,17 @@
    - Added viewport rotation.
    - Adapted for talos with with 4 runs on combinations of alpha/antialias
 
  Version 1.0
    - Benoit Jacob's WebGL tutorial demos: http://bjacob.github.io/webgl-tutorial/12-texture.html
 -->
 <head>
 <meta charset="utf-8"/>
-<script src="../../../../scripts/Profiler.js"></script>
+<script src="chrome://talos-powers-content/content/TalosContentProfiler.js"></script>
 <script type="x-shader/x-vertex" id="vertexShader">
   attribute vec3 vertexPosition;
   attribute vec3 normalVector;
   attribute vec2 textureCoord;
   uniform mat4 modelview;
   uniform mat4 projection;
   varying vec3 varyingNormalVector;
   varying vec2 varyingTextureCoord;
@@ -192,38 +192,41 @@
   var gCurrentTimestamp = 0;
   var gResultTimestamps = [];
 
   function startTestLoop(doneCallback) {
     gDoneCallback = doneCallback;
     gCurrentTimestamp = 0;
     gResultTimestamps = new Array(WARMUP_TIMESTAMPS + MEASURED_FRAMES);
 
-    Profiler.resume("Starting requestAnimationFrame loop", true);
-    requestAnimationFrame(draw);
+    TalosContentProfiler.resume("Starting requestAnimationFrame loop", true).then(() => {
+      requestAnimationFrame(draw);
+    });
   }
 
   function draw(timestamp) {
     // It's possible that under some implementations (even if not our current one),
     // the rAF callback arg will be in some way "optimized", e.g. always point to the
     // estimated next vsync timestamp, in order to allow the callee to have less
     // jitter in its time-dependent positioning/processing.
     // Such behaviour would harm our measurements, especially with vsync off.
     // performance.now() will not have this potential issue and is high-resolution.
     gResultTimestamps[gCurrentTimestamp++] = performance.now();
     var recordedTimestamps = gCurrentTimestamp;
     if (recordedTimestamps >= WARMUP_TIMESTAMPS + MEASURED_FRAMES) {
-      Profiler.pause("Stopping requestAnimationFrame loop", true);
-      var intervals = [];
-      var lastWarmupTimestampId = WARMUP_TIMESTAMPS - 1;
-      for (var i = lastWarmupTimestampId + 1; i < gResultTimestamps.length; i++) {
-        intervals.push(gResultTimestamps[i] - gResultTimestamps[i - 1]);
-      }
+      TalosContentProfiler.pause("Stopping requestAnimationFrame loop", true).then(() => {
+        var intervals = [];
+        var lastWarmupTimestampId = WARMUP_TIMESTAMPS - 1;
+        for (var i = lastWarmupTimestampId + 1; i < gResultTimestamps.length; i++) {
+          intervals.push(gResultTimestamps[i] - gResultTimestamps[i - 1]);
+        }
 
-      gDoneCallback(intervals);
+        gDoneCallback(intervals);
+      });
+
       return;
     }
 
     // Used for rendering reproducible frames which are independent of actual performance (timestamps).
     var simulatedTimestamp = gCurrentTimestamp * 1000 / 60;
 
     var speed = 0.001;
     var angle =  simulatedTimestamp * speed;