Bug 1374333 - Use TalosContentProfiler to fix profiling in bloom_basic tests. r?rwood draft
authorMike Conley <mconley@mozilla.com>
Wed, 12 Jul 2017 14:09:26 -0400
changeset 610838 22821f1c5655c47747892e4daf277c9ccbfa8902
parent 610837 9f6cf798d1616fb14195891aa365c6e0f9752304
child 610839 3cf6ddff9edc24388a0b92e1abcdd5c7418e1031
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 bloom_basic tests. r?rwood MozReview-Commit-ID: 6EH02ebboBu
testing/talos/talos/tests/perf-reftest/bloom-basic-ref.html
testing/talos/talos/tests/perf-reftest/bloom-basic.html
--- a/testing/talos/talos/tests/perf-reftest/bloom-basic-ref.html
+++ b/testing/talos/talos/tests/perf-reftest/bloom-basic-ref.html
@@ -1,29 +1,34 @@
 <!DOCTYPE html>
 <html>
   <head>
     <script src="util.js"></script>
+    <script src="chrome://talos-powers-content/content/TalosContentProfiler.js"></script>
     <script>
 /* import-globals-from util.js */
 window.onload = function() {
   document.head.appendChild(build_rule("span > div", 10000, "{ color: blue; } "));
   let dom = build_dom(5000, "div");
 
-  let start = performance.now();
-  document.body.appendChild(dom);
-  window.foo = window.getComputedStyle(document.body).color;
-  let end = performance.now();
+  TalosContentProfiler.resume("bloom_basic_ref start", true).then(() => {
+    let start = performance.now();
+    document.body.appendChild(dom);
+    window.foo = window.getComputedStyle(document.body).color;
+    let end = performance.now();
 
-  // when running in talos report results; when running outside talos just alert
-  if (window.tpRecordTime) {
-    window.tpRecordTime(end - start, start);
-  } else {
-    console.log(end);
-    console.log(start);
-    alert("Result: " + (end - start).toFixed(2) + " (ms)");
-  }
+    TalosContentProfiler.pause("bloom_basic_ref finish", true).then(() => {
+      // when running in talos report results; when running outside talos just alert
+      if (window.tpRecordTime) {
+        window.tpRecordTime(end - start, start);
+      } else {
+        console.log(end);
+        console.log(start);
+        alert("Result: " + (end - start).toFixed(2) + " (ms)");
+      }
+    });
+  });
 }
     </script>
   </head>
   <body>
   </body>
 </html>
--- a/testing/talos/talos/tests/perf-reftest/bloom-basic.html
+++ b/testing/talos/talos/tests/perf-reftest/bloom-basic.html
@@ -1,29 +1,34 @@
 <!DOCTYPE html>
 <html>
   <head>
     <script src="util.js"></script>
+    <script src="chrome://talos-powers-content/content/TalosContentProfiler.js"></script>
     <script>
 /* import-globals-from util.js */
 window.onload = function() {
   document.head.appendChild(build_rule("span div", 10000, "{ color: blue; } "));
   let dom = build_dom(5000, "div");
 
-  let start = performance.now();
-  document.body.appendChild(dom);
-  window.foo = window.getComputedStyle(document.body).color;
-  let end = performance.now();
+  TalosContentProfiler.resume("bloom_basic start", true).then(() => {
+    let start = performance.now();
+    document.body.appendChild(dom);
+    window.foo = window.getComputedStyle(document.body).color;
+    let end = performance.now();
 
-  // when running in talos report results; when running outside talos just alert
-  if (window.tpRecordTime) {
-    window.tpRecordTime(end - start, start);
-  } else {
-    console.log(end);
-    console.log(start);
-    alert("Result: " + (end - start).toFixed(2) + " (ms)");
-  }
+    TalosContentProfiler.pause("bloom_basic end", true).then(() => {
+      // when running in talos report results; when running outside talos just alert
+      if (window.tpRecordTime) {
+        window.tpRecordTime(end - start, start);
+      } else {
+        console.log(end);
+        console.log(start);
+        alert("Result: " + (end - start).toFixed(2) + " (ms)");
+      }
+    });
+  });
 }
     </script>
   </head>
   <body>
   </body>
 </html>