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