зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1336389 - Talos test for content process startup time. r=mconley
This commit is contained in:
Родитель
0674dd12d2
Коммит
ed23427f8d
|
@ -46,6 +46,9 @@ with Files("talos/talos/tests/scroll/**"):
|
|||
with Files("talos/talos/tests/tabpaint/**"):
|
||||
BUG_COMPONENT = ("Firefox", "Tabbed Browser")
|
||||
|
||||
with Files("talos/talos/tests/cpstartup/**"):
|
||||
BUG_COMPONENT = ("Firefox", "Tabbed Browser")
|
||||
|
||||
with Files("talos/talos/tests/tart/**"):
|
||||
BUG_COMPONENT = ("Firefox", "Tabbed Browser")
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
"tests": ["dromaeo_css", "kraken"]
|
||||
},
|
||||
"other-e10s": {
|
||||
"tests": ["a11yr", "ts_paint", "tpaint", "sessionrestore", "sessionrestore_many_windows", "sessionrestore_no_auto_restore", "tabpaint"]
|
||||
"tests": ["a11yr", "ts_paint", "tpaint", "sessionrestore", "sessionrestore_many_windows", "sessionrestore_no_auto_restore", "tabpaint", "cpstartup"]
|
||||
},
|
||||
"other-stylo-disabled-e10s": {
|
||||
"talos_options": ["--disable-stylo"],
|
||||
"tests": ["a11yr", "ts_paint", "tpaint", "sessionrestore", "sessionrestore_many_windows", "sessionrestore_no_auto_restore", "tabpaint"]
|
||||
"tests": ["a11yr", "ts_paint", "tpaint", "sessionrestore", "sessionrestore_many_windows", "sessionrestore_no_auto_restore", "tabpaint", "cpstartup"]
|
||||
},
|
||||
"g1-e10s": {
|
||||
"tests": ["tp5o_scroll", "glterrain"],
|
||||
|
|
|
@ -304,6 +304,28 @@ class tabpaint(PageloaderTest):
|
|||
}
|
||||
|
||||
|
||||
@register_test()
|
||||
class cpstartup(PageloaderTest):
|
||||
"""
|
||||
|
||||
"""
|
||||
extensions = '${talos}/tests/cpstartup/cpstartup-signed.xpi'
|
||||
tpmanifest = '${talos}/tests/cpstartup/cpstartup.manifest'
|
||||
tppagecycles = 20
|
||||
gecko_profile_entries = 1000000
|
||||
tploadnocache = True
|
||||
unit = 'ms'
|
||||
preferences = {
|
||||
# By default, Talos is configured to open links from
|
||||
# content in new windows. We're overriding them so that
|
||||
# they open in new tabs instead.
|
||||
# See http://kb.mozillazine.org/Browser.link.open_newwindow
|
||||
# and http://kb.mozillazine.org/Browser.link.open_newwindow.restriction
|
||||
'browser.link.open_newwindow': 3,
|
||||
'browser.link.open_newwindow.restriction': 2,
|
||||
}
|
||||
|
||||
|
||||
@register_test()
|
||||
class tps(PageloaderTest):
|
||||
"""
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const PREALLOCATED_PREF = "dom.ipc.processPrelaunch.enabled";
|
||||
|
||||
const TARGET_URI = "chrome://cpstartup/content/target.html";
|
||||
|
||||
/**
|
||||
* The purpose of this test it to measure the performance of a content process startup.
|
||||
*
|
||||
* In practice it measures a bit more than the content process startup. First the parent
|
||||
* process starts the clock and requests a new tab with a simple page and then the child
|
||||
* stops the clock in the frame script that will be able to process the URL to handle.
|
||||
* So it does measure a few things pre process creation (browser element and tab creation
|
||||
* on parent side) but does not measure the part where we actually parse and render the
|
||||
* page on the content side, just the overhead of spawning a new content process.
|
||||
*/
|
||||
var CPStartup = {
|
||||
MESSAGES: [
|
||||
"CPStartup:Go",
|
||||
"Content:BrowserChildReady",
|
||||
],
|
||||
|
||||
readyCallback: null,
|
||||
|
||||
startStamp: null,
|
||||
|
||||
tab: null,
|
||||
/**
|
||||
* Shortcut to getting at the TalosParentProfiler.
|
||||
*/
|
||||
get Profiler() {
|
||||
delete this.Profiler;
|
||||
let context = {};
|
||||
Services.scriptloader.loadSubScript("chrome://talos-powers-content/content/TalosParentProfiler.js", context);
|
||||
return this.Profiler = context.TalosParentProfiler;
|
||||
},
|
||||
|
||||
init() {
|
||||
for (let msgName of this.MESSAGES) {
|
||||
Services.mm.addMessageListener(msgName, this);
|
||||
}
|
||||
|
||||
this.originalPreallocatedEnabled = Services.prefs.getBoolPref(PREALLOCATED_PREF);
|
||||
Services.prefs.setBoolPref(PREALLOCATED_PREF, false);
|
||||
},
|
||||
|
||||
uninit() {
|
||||
for (let msgName of this.MESSAGES) {
|
||||
Services.mm.removeMessageListener(msgName, this);
|
||||
}
|
||||
|
||||
Services.prefs.setBoolPref(PREALLOCATED_PREF, this.originalPreallocatedEnabled);
|
||||
},
|
||||
|
||||
receiveMessage(msg) {
|
||||
let browser = msg.target;
|
||||
let gBrowser = browser.ownerGlobal.gBrowser;
|
||||
|
||||
switch (msg.name) {
|
||||
case "CPStartup:Go": {
|
||||
this.openTab(gBrowser).then(results =>
|
||||
this.reportResults(results));
|
||||
break;
|
||||
}
|
||||
|
||||
case "Content:BrowserChildReady": {
|
||||
// Content has reported that it's ready to process an URL.
|
||||
if (!this.readyCallback) {
|
||||
throw new Error("Content:BrowserChildReady fired without a readyCallback set");
|
||||
}
|
||||
let tab = gBrowser.getTabForBrowser(browser);
|
||||
if (tab != this.tab) {
|
||||
// Let's ignore the message if it's not from the tab we've just opened.
|
||||
break;
|
||||
}
|
||||
// The child stopped the timer when it was ready to process the first URL, it's time to
|
||||
// calculate the difference and report it.
|
||||
let delta = msg.data.time - this.startStamp;
|
||||
this.readyCallback({tab, delta});
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
openTab(gBrowser) {
|
||||
return new Promise((resolve) => {
|
||||
// Start the timer and the profiler right before the tab open on the parent side.
|
||||
this.Profiler.resume("tab opening starts");
|
||||
this.startStamp = Services.telemetry.msSystemNow();
|
||||
this.tab = gBrowser.selectedTab = gBrowser.addTab(TARGET_URI, {
|
||||
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
});
|
||||
|
||||
this.whenTabReady().then(({tab, delta}) => {
|
||||
this.Profiler.pause("tab opening end");
|
||||
this.removeTab(tab).then(() => {
|
||||
resolve(delta);
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
whenTabReady() {
|
||||
return new Promise((resolve) => {
|
||||
this.readyCallback = resolve;
|
||||
});
|
||||
},
|
||||
|
||||
removeTab(tab) {
|
||||
return new Promise((resolve) => {
|
||||
let {messageManager: mm, frameLoader} = tab.linkedBrowser;
|
||||
mm.addMessageListener("SessionStore:update", function onMessage(msg) {
|
||||
if (msg.targetFrameLoader == frameLoader && msg.data.isFinal) {
|
||||
mm.removeMessageListener("SessionStore:update", onMessage);
|
||||
resolve();
|
||||
}
|
||||
}, true);
|
||||
|
||||
tab.ownerGlobal.gBrowser.removeTab(tab);
|
||||
});
|
||||
},
|
||||
|
||||
reportResults(results) {
|
||||
Services.mm.broadcastAsyncMessage("CPStartup:FinalResults", results);
|
||||
},
|
||||
};
|
||||
|
||||
function install(aData, aReason) {}
|
||||
|
||||
function startup(aData, aReason) {
|
||||
CPStartup.init();
|
||||
}
|
||||
|
||||
function shutdown(aData, aReason) {
|
||||
CPStartup.uninit();
|
||||
}
|
||||
|
||||
function uninstall(aData, aReason) {}
|
|
@ -0,0 +1 @@
|
|||
content cpstartup content/ remoteenabled=yes contentaccessible=yes
|
|
@ -0,0 +1,31 @@
|
|||
<html>
|
||||
<head>
|
||||
<script>
|
||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
function init() {
|
||||
if (document.location.hash.indexOf("#auto") == 0) {
|
||||
let mm = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIContentFrameMessageManager);
|
||||
|
||||
mm.addMessageListener("CPStartup:FinalResults", function onResults(msg) {
|
||||
mm.removeMessageListener("CPStartup:FinalResults", onResults);
|
||||
let results = msg.data;
|
||||
|
||||
tpRecordTime(results, 0, "content-process-startup");
|
||||
});
|
||||
|
||||
mm.sendAsyncMessage("CPStartup:Go");
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init();">
|
||||
Hello, Talos!
|
||||
|
||||
<a href="#" id="target" target="_blank">I'll open a new tab</a>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,9 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Content Process Startup</title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"></meta>
|
||||
</head>
|
||||
<body>
|
||||
<p>Content Process Startup</p>
|
||||
</body>
|
||||
</html>
|
Двоичный файл не отображается.
|
@ -0,0 +1 @@
|
|||
% chrome://cpstartup/content/cpstartup.html#auto
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0"?>
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>cpstartup-test@mozilla.org</em:id>
|
||||
<em:type>2</em:type>
|
||||
<em:name>cpstartup test</em:name>
|
||||
<em:version>1.0.0</em:version>
|
||||
<em:bootstrap>true</em:bootstrap>
|
||||
<em:description>Measures the performance of starting and initializing new content processes</em:description>
|
||||
<em:creator>Gabor Krizsanits</em:creator>
|
||||
<em:multiprocessCompatible>true</em:multiprocessCompatible>
|
||||
|
||||
<!-- Desktop -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||
<em:minVersion>55.0</em:minVersion>
|
||||
<em:maxVersion>*</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
</Description>
|
||||
<em:description>https://wiki.mozilla.org/Buildbot/Talos/Tests</em:description>
|
||||
<em:homepageURL>https://wiki.mozilla.org/Buildbot/Talos/Tests</em:homepageURL>
|
||||
</RDF>
|
|
@ -257,6 +257,8 @@ var WebNavigation = {
|
|||
addMessageListener("WebNavigation:SetOriginAttributes", this);
|
||||
addMessageListener("WebNavigation:Reload", this);
|
||||
addMessageListener("WebNavigation:Stop", this);
|
||||
// This message is used for measuring content process startup performance.
|
||||
sendAsyncMessage("Content:BrowserChildReady", { time: Services.telemetry.msSystemNow() });
|
||||
},
|
||||
|
||||
get webNavigation() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче