зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1239750 - Add DAMP measurement for bulk console.log performance;r=fitzgen
--HG-- extra : commitid : 2SbKBMFRytL
This commit is contained in:
Родитель
e92e2b834a
Коммит
9903b5fdbe
|
@ -17,6 +17,7 @@ var defaultConfig = {
|
|||
performanceOpen: true,
|
||||
netmonitorOpen: true,
|
||||
saveAndReadHeapSnapshot: true,
|
||||
consoleBulkLogging: true,
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -28,6 +29,7 @@ var testsInfo = {
|
|||
performanceOpen: "Measure open/close toolbox on performance panel",
|
||||
netmonitorOpen: "Measure open/close toolbox on network monitor panel",
|
||||
saveAndReadHeapSnapshot: "Measure open/close toolbox on memory panel and save/read heap snapshot",
|
||||
consoleBulkLogging: "Measure time for a bunch of sync console.log statements to appear",
|
||||
};
|
||||
|
||||
function updateConfig() {
|
||||
|
|
|
@ -112,6 +112,55 @@ Damp.prototype = {
|
|||
return Promise.resolve();
|
||||
},
|
||||
|
||||
_consoleBulkLoggingTest: Task.async(function*() {
|
||||
let TOTAL_MESSAGES = 10;
|
||||
let tab = yield this.testSetup(SIMPLE_URL);
|
||||
let messageManager = tab.linkedBrowser.messageManager;
|
||||
let {toolbox} = yield this.openToolbox("webconsole");
|
||||
let webconsole = toolbox.getPanel("webconsole");
|
||||
|
||||
// Resolve once the last message has been received.
|
||||
let allMessagesReceived = new Promise(resolve => {
|
||||
function receiveMessages(e, messages) {
|
||||
for (let m of messages) {
|
||||
if (m.node.textContent.includes("damp " + TOTAL_MESSAGES)) {
|
||||
webconsole.hud.ui.off("new-messages", receiveMessages);
|
||||
// Wait for the console to redraw
|
||||
requestAnimationFrame(resolve);
|
||||
}
|
||||
}
|
||||
}
|
||||
webconsole.hud.ui.on("new-messages", receiveMessages);
|
||||
});
|
||||
|
||||
// Load a frame script using a data URI so we can do logs
|
||||
// from the page. So this is running in content.
|
||||
messageManager.loadFrameScript("data:,(" + encodeURIComponent(
|
||||
`function () {
|
||||
addMessageListener("do-logs", function () {
|
||||
for (var i = 0; i < ${TOTAL_MESSAGES}; i++) {
|
||||
content.console.log('damp', i+1, content);
|
||||
}
|
||||
});
|
||||
}`
|
||||
) + ")()", true);
|
||||
|
||||
// Kick off the logging
|
||||
messageManager.sendAsyncMessage("do-logs");
|
||||
|
||||
let start = performance.now();
|
||||
yield allMessagesReceived;
|
||||
let end = performance.now();
|
||||
|
||||
this._results.push({
|
||||
name: "console.bulklog",
|
||||
value: end - start
|
||||
});
|
||||
|
||||
yield this.closeToolbox(null);
|
||||
yield this.testTeardown();
|
||||
}),
|
||||
|
||||
takeCensus: function(label) {
|
||||
let start = performance.now();
|
||||
|
||||
|
@ -244,10 +293,11 @@ Damp.prototype = {
|
|||
},
|
||||
|
||||
testSetup: Task.async(function*(url) {
|
||||
yield this.addTab(url);
|
||||
let tab = yield this.addTab(url);
|
||||
yield new Promise(resolve => {
|
||||
setTimeout(resolve, this._config.rest);
|
||||
});
|
||||
return tab;
|
||||
}),
|
||||
|
||||
testTeardown: Task.async(function*(url) {
|
||||
|
@ -347,6 +397,10 @@ Damp.prototype = {
|
|||
let tests = [];
|
||||
tests = tests.concat(this._getToolLoadingTests(SIMPLE_URL, "simple"));
|
||||
tests = tests.concat(this._getToolLoadingTests(COMPLICATED_URL, "complicated"));
|
||||
|
||||
if (config.subtests.indexOf("consoleBulkLogging") > -1) {
|
||||
tests = tests.concat(this._consoleBulkLoggingTest);
|
||||
}
|
||||
this._doSequence(tests, this._doneInternal);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче