зеркало из https://github.com/mozilla/pjs.git
Adding startup-test.html for tinderbox startup test. r=jag, sr=waterson
This commit is contained in:
Родитель
27a07e3ab4
Коммит
1d2d3697ed
|
@ -34,3 +34,7 @@ include $(topsrcdir)/config/rules.mk
|
|||
# Install bloaturls.txt file for tinderbox Bloaty test.
|
||||
install:: $(srcdir)/bloaturls.txt
|
||||
$(INSTALL) $< $(DIST)/bin
|
||||
|
||||
# Install startup.html, startup test page.
|
||||
install:: $(srcdir)/startup-test.html
|
||||
$(INSTALL) $< $(DIST)/bin
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<!-- Pick off begin time as a cgi argument and print it out -->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Mozilla Startup Timing Test</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
|
||||
// Pick off the time from the file URL.
|
||||
// file:///foo/startup.html?begin=986869269000
|
||||
function tokenizeQuery() {
|
||||
var query = {};
|
||||
var pairs = document.location.search.substring(1).split('&');
|
||||
for (var i=0; i < pairs.length; i++) {
|
||||
var pair = pairs[i].split('=');
|
||||
query[pair[0]] = unescape(pair[1]);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
// Dump startup time out to console.
|
||||
function phoneHome() {
|
||||
var testFoo;
|
||||
var now = (new Date()).getTime();
|
||||
var q = tokenizeQuery();
|
||||
var begin = q['begin'] || 0; // when did perl launch this
|
||||
var startupTime = now - begin;
|
||||
document.write('\n\nStartup time = ' + startupTime + ' ms<br>');
|
||||
if (window.dump) {
|
||||
dump('\n\n__startuptime: ' + startupTime + ' ms\n\n');
|
||||
}
|
||||
}
|
||||
|
||||
// As soon as page loads, print out time.
|
||||
window.onload = phoneHome();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче