Bug 1374333 - Use TalosContentProfiler to fix profiling in glterrain tests. r?rwood
MozReview-Commit-ID: FQl58ZNyFCl
--- 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;