blob: 265bd14c2581299d9994fd552de73e95f12c9d4b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
print = function(o) {
console.log(o);
if (window.dump) {
window.dump(o + '\n');
}
}
function formatLine(name, t) {
print("[PERF]," + name + "," + t);
}
function printPerfTiming() {
print("[PERF] perf block start")
formatLine("testcase", window.location);
formatLine("title", document.title.replace(/,/g, ","));
var entries = performance.getEntriesByName(window.location);
for (entry in entries) {
for (key in entries[entry]) {
if (typeof entries[entry][key] === "number") {
formatLine(key, entries[entry][key]);
}
}
}
print("[PERF] perf block end")
}
if (document.readyState === "complete") {
printPerfTiming()
window.close();
} else {
window.addEventListener('load', function () {
window.setTimeout(printPerfTiming, 0);
});
var timeout = 5;
window.setTimeout(function() {
print("[PERF] Timeout after " + timeout + " min. Force stop");
printPerfTiming();
window.close();
}, timeout * 60 * 1000)
}
|