From 9fd4018d70903b28aa1c790f037f87a0022cc675 Mon Sep 17 00:00:00 2001 From: Rob Wood Date: Fri, 9 Feb 2018 18:46:04 -0500 Subject: [PATCH] Bug 1384272 - Add a talos test that tracks the performance of opening about:preferences; r=jmaher MozReview-Commit-ID: LuHosK5chMN --HG-- extra : rebase_source : 2bdf10c088c9a93b91cd09a85f62630c53bd3992 --- testing/talos/talos.json | 6 ++-- .../talos/pageloader/chrome/lh_fnbpaint.js | 9 +++--- .../talos/pageloader/chrome/pageloader.js | 32 +++++++++++++++++++ .../talos/talos/pageloader/chrome/report.js | 4 +++ testing/talos/talos/run_tests.py | 3 -- testing/talos/talos/test.py | 19 +++++++++++ .../about_preferences_basic.manifest | 7 ++++ 7 files changed, 70 insertions(+), 10 deletions(-) create mode 100644 testing/talos/talos/tests/about-preferences/about_preferences_basic.manifest diff --git a/testing/talos/talos.json b/testing/talos/talos.json index 6ae5ac3192f7..3561feb469b6 100644 --- a/testing/talos/talos.json +++ b/testing/talos/talos.json @@ -1,11 +1,11 @@ { "suites": { "chromez-e10s": { - "tests": ["tresize"] + "tests": ["about_preferences_basic", "tresize"] }, "chromez-profiling-e10s": { "talos_options": ["--geckoProfile"], - "tests": ["tresize"] + "tests": [ "about_preferences_basic", "tresize"] }, "dromaeojs-e10s": { "tests": ["dromaeo_css", "kraken"] @@ -150,7 +150,7 @@ }, "h1-e10s": { "tests": ["ts_paint_heavy"] - }, + }, "h2-e10s": { "tests": ["tp6_google_heavy", "tp6_youtube_heavy", "tp6_amazon_heavy", "tp6_facebook_heavy"], "mitmproxy_release_bin_osx": "mitmproxy-2.0.2-osx.tar.gz", diff --git a/testing/talos/talos/pageloader/chrome/lh_fnbpaint.js b/testing/talos/talos/pageloader/chrome/lh_fnbpaint.js index dae63f65333c..a74b1d92352a 100644 --- a/testing/talos/talos/pageloader/chrome/lh_fnbpaint.js +++ b/testing/talos/talos/pageloader/chrome/lh_fnbpaint.js @@ -1,9 +1,8 @@ /* 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 gRetryCounter = 0; var gErr = "Abort: firstNonBlankPaint value is not available after loading the page"; - +var gRetryCounter = 0; function _contentFNBPaintHandler() { var x = content.window.performance.timing.timeToNonBlankPaint; @@ -11,15 +10,17 @@ function _contentFNBPaintHandler() { sendAsyncMessage("PageLoader:Error", {"msg": gErr}); } if (x > 0) { + dump("received fnbpaint value\n"); sendAsyncMessage("PageLoader:LoadEvent", {"time": x, "name": "fnbpaint"}); + gRetryCounter = 0; } else { gRetryCounter += 1; if (gRetryCounter <= 10) { - dump("fnbpaint is not yet available (0), retry number " + gRetryCounter + "...\n"); + dump("\nfnbpaint is not yet available (0), retry number " + gRetryCounter + "...\n"); content.setTimeout(_contentFNBPaintHandler, 100); } else { - dump("unable to get a value for fnbpaint after " + gRetryCounter + " retries\n"); + dump("\nunable to get a value for fnbpaint after " + gRetryCounter + " retries\n"); sendAsyncMessage("PageLoader:Error", {"msg": gErr}); } } diff --git a/testing/talos/talos/pageloader/chrome/pageloader.js b/testing/talos/talos/pageloader/chrome/pageloader.js index 22db00017350..39dc732106b2 100644 --- a/testing/talos/talos/pageloader/chrome/pageloader.js +++ b/testing/talos/talos/pageloader/chrome/pageloader.js @@ -31,6 +31,7 @@ var forceCC = true; var useMozAfterPaint = false; var useFNBPaint = false; +var isFNBPaintPending = false; var useHero = false; var gPaintWindow = window; var gPaintListener = false; @@ -311,6 +312,10 @@ function plLoadPage() { // record which page we are about to open TalosParentProfiler.mark("Opening " + pages[pageIndex].url.pathQueryRef); + if (useFNBPaint) { + isFNBPaintPending = true; + } + startAndLoadURI(pageName); } @@ -392,6 +397,14 @@ var plNextPage = async function() { await waitForIdleCallback(); } + if (useFNBPaint) { + // don't move to next page until we've received fnbpaint + if (isFNBPaintPending) { + dumpLine("Waiting for fnbpaint"); + await waitForFNBPaint(); + } + } + if (profilingInfo) { await TalosParentProfiler.finishTest(); } @@ -448,6 +461,19 @@ function plIdleCallbackReceived() { isIdleCallbackPending = false; } +function waitForFNBPaint() { + return new Promise(resolve => { + function checkForFNBPaint() { + if (!isFNBPaintPending) { + resolve(); + } else { + setTimeout(checkForFNBPaint, 200); + } + } + checkForFNBPaint(); + }); +} + function forceContentGC() { return new Promise((resolve) => { let mm = browserWindow.getBrowser().selectedBrowser.messageManager; @@ -618,6 +644,7 @@ function _loadHandler(paint_time = 0) { if (paint_time !== 0) { // window.performance.timing.timeToNonBlankPaint is a timestamp + // this may have a value for hero element (also a timestamp) end_time = paint_time; } else { end_time = Date.now(); @@ -645,7 +672,12 @@ function plLoadHandlerMessage(message) { // we can record several times per load. if (message.json.time !== undefined) { paint_time = message.json.time; + if (message.json.name == "fnbpaint") { + // we've received fnbpaint; no longer pending for this current pageload + isFNBPaintPending = false; + } } + failTimeout.clear(); if ((plPageFlags() & EXECUTE_SCROLL_TEST)) { diff --git a/testing/talos/talos/pageloader/chrome/report.js b/testing/talos/talos/pageloader/chrome/report.js index 738e01446131..58d4357a7eaa 100644 --- a/testing/talos/talos/pageloader/chrome/report.js +++ b/testing/talos/talos/pageloader/chrome/report.js @@ -67,6 +67,10 @@ Report.prototype.getReport = function() { report += "|i|pagename|runs|\n"; for (var i = 0; i < pages.length; i++) { + // don't report any measurements that were reported for about:blank + // some tests (like about-preferences) use it as a dummy test page + if (pages[i] == "about:blank") + continue; report += "|" + i + ";" + pages[i].substr(prefixLen) + ";" + diff --git a/testing/talos/talos/run_tests.py b/testing/talos/talos/run_tests.py index 74401d878a17..1bff5e87dc76 100755 --- a/testing/talos/talos/run_tests.py +++ b/testing/talos/talos/run_tests.py @@ -75,9 +75,6 @@ def set_tp_preferences(test, browser_config): if _pref_name in test['preferences']: del test['preferences'][_pref_name] - LOG.info("* RW * preferences are now:") - LOG.info(test['preferences']) - def setup_webserver(webserver): """use mozhttpd to setup a webserver""" diff --git a/testing/talos/talos/test.py b/testing/talos/talos/test.py index 9d3778c544ad..90b9a5ce9358 100644 --- a/testing/talos/talos/test.py +++ b/testing/talos/talos/test.py @@ -996,3 +996,22 @@ class rasterflood_gradient(PageloaderTest): 'dom.send_after_paint_to_content': False} lower_is_better = False unit = 'score' + + +@register_test() +class about_preferences_basic(PageloaderTest): + """ + Base class for about_preferences test + """ + tpmanifest = '${talos}/tests/about-preferences/about_preferences_basic.manifest' + # this test uses 'about:blank' as a dummy page (see manifest) so that the pages + # that just change url categories (i.e. about:preferences#search) will get a load event + # also any of the url category pages cannot have more than one tppagecycle + tpcycles = 25 + tppagecycles = 1 + gecko_profile_interval = 1 + gecko_profile_entries = 2000000 + filters = filter.ignore_first.prepare(5) + filter.median.prepare() + unit = 'ms' + lower_is_better = True + fnbpaint = True diff --git a/testing/talos/talos/tests/about-preferences/about_preferences_basic.manifest b/testing/talos/talos/tests/about-preferences/about_preferences_basic.manifest new file mode 100644 index 000000000000..6164b5f1b25f --- /dev/null +++ b/testing/talos/talos/tests/about-preferences/about_preferences_basic.manifest @@ -0,0 +1,7 @@ +about:preferences +about:blank +about:preferences#search +about:blank +about:preferences#privacy +about:blank +about:preferences#sync \ No newline at end of file