Bug 1378139 - Add stylo-only talos test suite for perf-reftest singletons; r=igoldan

MozReview-Commit-ID: 58yFIGLxyKm

--HG--
extra : rebase_source : fe3d673afa73c46d5e2dcf564634449bec5c9f8b
This commit is contained in:
Rob Wood 2017-07-05 11:17:31 -04:00
Родитель b95ebf372e
Коммит 568d7f1706
5 изменённых файлов: 126 добавлений и 0 удалений

Просмотреть файл

@ -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",

Просмотреть файл

@ -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):
"""

Просмотреть файл

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<script>
/* globals build_rule build_dom flush_style perf_start perf_finish */
/* eslint no-undef: "error" */
</script>
<script src="util.js"></script>
<script>
window.onload = function() {
document.head.appendChild(build_rule("caption div, caption span", 20000, "{ color: blue; } "));
let dom = build_dom(5000, "div");
flush_style();
perf_start();
document.body.appendChild(dom);
flush_style(dom);
perf_finish();
}
</script>
</head>
<body>
</body>
</html>

Просмотреть файл

@ -0,0 +1 @@
% http://localhost/tests/perf-reftest/bloom-basic.html

Просмотреть файл

@ -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 });
});
}