Bug 408228 - Make Talos more suitable for memory resident testing a=schrep r=vlad

This commit is contained in:
anodelman@mozilla.com 2008-01-24 11:55:57 -08:00
Родитель e84879ad78
Коммит 7c4e86035b
2 изменённых файлов: 67 добавлений и 19 удалений

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

@ -58,9 +58,13 @@ var report;
var renderReport;
var noisy = false;
var timeout = -1;
var quitDelay = 0;
var timeoutEvent = -1;
var running = false;
var forceCC = true;
var wwatch = null;
var blank = null;
var browserLoadFunc = null;
var content;
@ -71,6 +75,23 @@ var browserWindow = null;
// the io service
var gIOS = null;
var numWindows = 1;
var windows = Array();
var windowNum = 0;
function plCreateWindow() {
if (windows[windowNum]) {
windows[windowNum].close();
windows[windowNum] = null;
}
browserWindow = windows[windowNum] = wwatch.openWindow
(null, "chrome://browser/content/", "_blank",
"chrome,dialog=no,width=" + winWidth + ",height=" + winHeight, blank);
browserWindow.addEventListener('load', browserLoadFunc, true);
}
function plInit() {
if (running) {
return;
@ -94,6 +115,8 @@ function plInit() {
if (args.filter) pageFilterRegexp = new RegExp(args.filter);
if (args.noisy) noisy = true;
if (args.timeout) timeout = parseInt(args.timeout);
if (args.quitDelay) quitDelay = parseInt(args.quitDelay);
if (args.numWindows) numWindows = parseInt(args.numWindows);
forceCC = !args.noForceCC;
doRenderTest = args.doRender;
@ -121,6 +144,11 @@ function plInit() {
plStop(true);
}
if ((!args.useBrowserChrome) && (numWindows > 1)) {
dumpLine('tp: numWindows > 1 does not work without browser chrome');
plStop(true);
}
if (startIndex < 0)
startIndex = 0;
if (endIndex == -1 || endIndex >= pages.length)
@ -140,19 +168,20 @@ function plInit() {
pageIndex = 0;
if (args.useBrowserChrome) {
var wwatch = Cc["@mozilla.org/embedcomp/window-watcher;1"]
wwatch = Cc["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Ci.nsIWindowWatcher);
var blank = Cc["@mozilla.org/supports-string;1"]
blank = Cc["@mozilla.org/supports-string;1"]
.createInstance(Ci.nsISupportsString);
blank.data = "about:blank";
browserWindow = wwatch.openWindow
browserWindow = windows[windowNum] = wwatch.openWindow
(null, "chrome://browser/content/", "_blank",
"chrome,dialog=no,width=" + winWidth + ",height=" + winHeight, blank);
// get our window out of the way
window.resizeTo(10,10);
var browserLoadFunc = function (ev) {
browserLoadFunc = function (ev) {
browserWindow.removeEventListener('load', browserLoadFunc, true);
// do this half a second after load, because we need to be
@ -160,7 +189,7 @@ function plInit() {
// by the persisted values
setTimeout(function () {
browserWindow.resizeTo(winWidth, winHeight);
browserWindow.moveTo(0, 0);
browserWindow.moveTo(30*windowNum, 30*windowNum);
browserWindow.focus();
content = browserWindow.getBrowser();
@ -238,8 +267,15 @@ function plNextPage() {
var tccend = new Date();
report.recordCCTime(tccend - tccstart);
}
setTimeout(plLoadPage, 250);
if (numWindows > 1) {
// Move our window index forward
windowNum = (windowNum + 1) % numWindows;
// Create windows as needed
plCreateWindow();
} else {
setTimeout(plLoadPage, 250);
}
} else {
plStop(false);
}
@ -323,6 +359,19 @@ function runRenderTest() {
renderReport.recordTime(pageIndex, end - start);
}
function plDumpReports() {
var formats = reportFormat.split(",");
if (!renderReport) {
for each (var fmt in formats)
dumpLine(report.getReport(fmt));
} else {
dumpLine ("*************** Render report *******************");
for each (var fmt in formats)
dumpLine(renderReport.getReport(fmt));
}
}
function plStop(force) {
try {
if (force == false) {
@ -332,19 +381,14 @@ function plStop(force) {
setTimeout(plLoadPage, 250);
return;
}
// Close all the windows
for each (var window in windows)
window.close();
var formats = reportFormat.split(",");
if (!renderReport) {
for each (var fmt in formats)
dumpLine(report.getReport(fmt));
}
else {
dumpLine ("*************** Render report *******************");
for each (var fmt in formats)
dumpLine(renderReport.getReport(fmt));
}
}
// Leave time at the end for the browser to clean up for better memory usage measurements
setTimeout(plDumpReports, quitDelay);
return;
}
} catch (e) {
dumpLine(e);
}

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

@ -91,6 +91,8 @@ PageLoaderCmdLineHandler.prototype =
args.offline = cmdLine.handleFlag("tpoffline", false);
args.noisy = cmdLine.handleFlag("tpnoisy", false);
args.timeout = cmdLine.handleFlagWithParam("tptimeout", false);
args.quitDelay = cmdLine.handleFlagWithParam("tpquitdelay", false);
args.numWindows = cmdLine.handleFlagWithParam("tpnumwindows", false);
args.noForceCC = cmdLine.handleFlag("tpnoforcecc", false);
}
catch (e) {
@ -121,6 +123,8 @@ PageLoaderCmdLineHandler.prototype =
" -tpoffline Force offline mode\n" +
" -tpnoisy Dump the name of the last loaded page to console\n" +
" -tptimeout Max amount of time given for a page to load, quit if exceeded\n" +
" -tpquitdelay Number of milliseconds to pause before quitting the browser at the end of the text\n" +
" -tpnumwindows Number of windows to have open during the test run. If 1 all pageloads will happen in same window\n" +
" -tpnoforcecc Don't force cycle collection between each pageload\n"
};