diff --git a/testing/talos/talos.json b/testing/talos/talos.json index 47fb8424e0f0..40050023696c 100644 --- a/testing/talos/talos.json +++ b/testing/talos/talos.json @@ -87,6 +87,9 @@ "perf-reftest-e10s": { "tests": ["bloom_basic"] }, + "perf-reftest-singletons-e10s": { + "tests": ["bloom_basic_singleton"] + }, "tp5o": { "tests": ["tp5o"], "pagesets_name": "tp5n.zip", diff --git a/testing/talos/talos/test.py b/testing/talos/talos/test.py index f627f45da010..fca5f99de171 100644 --- a/testing/talos/talos/test.py +++ b/testing/talos/talos/test.py @@ -817,6 +817,22 @@ class bloom_basic(PageloaderTest): alert_threshold = 5.0 +@register_test() +class bloom_basic_singleton(PageloaderTest): + """ + Stylo bloom_basic: runs bloom_basic and bloom_basic_ref and reports difference + """ + tpmanifest = '${talos}/tests/perf-reftest-singletons/bloom_basic_singleton.manifest' + tpcycles = 1 + tppagecycles = 25 + gecko_profile_interval = 1 + gecko_profile_entries = 2000000 + filters = filter.ignore_first.prepare(5) + filter.median.prepare() + unit = 'ms' + lower_is_better = True + alert_threshold = 5.0 + + @register_test() class quantum_pageload_google(QuantumPageloadTest): """ diff --git a/testing/talos/talos/tests/perf-reftest-singletons/bloom-basic.html b/testing/talos/talos/tests/perf-reftest-singletons/bloom-basic.html new file mode 100644 index 000000000000..06ac169d56f6 --- /dev/null +++ b/testing/talos/talos/tests/perf-reftest-singletons/bloom-basic.html @@ -0,0 +1,24 @@ + + + + + + + + + + diff --git a/testing/talos/talos/tests/perf-reftest-singletons/bloom_basic_singleton.manifest b/testing/talos/talos/tests/perf-reftest-singletons/bloom_basic_singleton.manifest new file mode 100644 index 000000000000..3dd6dbc46ae0 --- /dev/null +++ b/testing/talos/talos/tests/perf-reftest-singletons/bloom_basic_singleton.manifest @@ -0,0 +1 @@ +% http://localhost/tests/perf-reftest/bloom-basic.html diff --git a/testing/talos/talos/tests/perf-reftest-singletons/util.js b/testing/talos/talos/tests/perf-reftest-singletons/util.js new file mode 100644 index 000000000000..bb0e7d86df63 --- /dev/null +++ b/testing/talos/talos/tests/perf-reftest-singletons/util.js @@ -0,0 +1,82 @@ +var perf_data = { + start: null, + end: null, +} + +function build_dom(n, elemName, options) { + // By default we use different elements in the DOM to defeat the style sharing + // cache, otherwise this sythetic DOM is trivially stylable by engines with that + // optimization. + options = options || {}; + var elemNameLeft = options.elemNameLeft || "div"; + var elemNameRight = options.elemNameRight || "span"; + + var ours = document.createElement(elemName); + for (var attr in options.attributes) { + ours.setAttribute(attr, options.attributes[attr]); + } + + if (n != 1) { + var leftSize = Math.floor(n / 2); + var rightSize = Math.floor((n - 1) / 2); + ours.appendChild(build_dom(leftSize, elemNameLeft, options)); + if (rightSize > 0) + ours.appendChild(build_dom(rightSize, elemNameRight, options)); + } + return ours; +} + +function build_rule(selector, selectorRepeat, declaration, ruleRepeat) { + ruleRepeat = ruleRepeat || 1; + var s = document.createElement("style"); + var rule = Array(selectorRepeat).fill(selector).join(", ") + declaration; + s.textContent = Array(ruleRepeat).fill(rule).join("\n\n"); + return s; +} + +function flush_style(element) { + getComputedStyle(element || document.documentElement).color; +} + +function perf_start() { + if (perf_data.start !== null) { + throw "already started timing!"; + } + + perf_data.start = performance.now(); +} + +function perf_finish() { + var end = performance.now(); + + if (perf_data.start === null) { + throw "haven't started timing!"; + } + + if (perf_data.end !== null) { + throw "already finished timing!"; + } + + var start = perf_data.start; + perf_data.end = end; + + // when running in talos report results; when running outside talos just alert + if (window.tpRecordTime) { + // Running in talos. + window.tpRecordTime(end - start, start); + } else if (window.parent && window.parent.report_perf_reftest_time) { + // Running in the perf-reftest runner. + window.parent.report_perf_reftest_time({ type: "time", value: end - start }); + } else { + // Running standalone; just alert. + console.log(end); + console.log(start); + alert("Result: " + (end - start).toFixed(2) + " (ms)"); + } +} + +if (window.parent.report_perf_reftest_time) { + window.addEventListener("error", function(e) { + window.parent.report_perf_reftest_time({ type: "error", value: e.message }); + }); +}