Bug 1406114 - remove rss, modified page list bytes, and possibly private bytes from talos counters. r=rwood
authorJoel Maher <jmaher@mozilla.com>
Fri, 06 Oct 2017 10:57:17 -0400
changeset 676120 9c7436ef3a1cda88574ed74a0d7228b456457a0f
parent 676119 85a4fbfc88efcbe88c2d7cd5a76c7916a80624b7
child 676121 a5d09006aea39570be08c827305c6e78cbdd8842
push id83398
push userbmo:rail@mozilla.com
push dateFri, 06 Oct 2017 17:12:44 +0000
reviewersrwood
bugs1406114
milestone58.0a1
Bug 1406114 - remove rss, modified page list bytes, and possibly private bytes from talos counters. r=rwood
testing/talos/talos/cmdline.py
testing/talos/talos/config.py
testing/talos/talos/output.py
testing/talos/talos/pageloader/chrome/memory.js
testing/talos/talos/pageloader/chrome/pageloader.js
testing/talos/talos/pageloader/chrome/pageloader.xul
testing/talos/talos/pageloader/components/tp-cmdline.js
testing/talos/talos/results.py
testing/talos/talos/run_tests.py
testing/talos/talos/test.py
--- a/testing/talos/talos/cmdline.py
+++ b/testing/talos/talos/cmdline.py
@@ -68,19 +68,16 @@ def create_parser(mach_interface=False):
             help="List of tests to run, separated by ':' (ex. damp:cart)")
     add_arg('--suite',
             help="Suite to use (instead of --activeTests)")
     add_arg('--disable-e10s', dest='e10s',
             action='store_false', default=True,
             help="disable e10s")
     add_arg('--noChrome', action='store_true',
             help="do not run tests as chrome")
-    add_arg('--rss', action='store_true',
-            help="Collect RSS counters from pageloader instead of the"
-                 " operating system")
     add_arg('--mainthread', action='store_true',
             help="Collect mainthread IO data from the browser by setting"
                  " an environment variable")
     add_arg("--mozAfterPaint", action='store_true', dest="tpmozafterpaint",
             help="wait for MozAfterPaint event before recording the time")
     add_arg("--firstPaint", action='store_true', dest="firstpaint",
             help="Also report the first paint value in supported tests")
     add_arg("--userReady", action='store_true', dest="userready",
--- a/testing/talos/talos/config.py
+++ b/testing/talos/talos/config.py
@@ -30,17 +30,16 @@ DEFAULTS = dict(
         cycles=1,
         profile_path='${talos}/base_profile',
         responsiveness=False,
         e10s=False,
         gecko_profile=False,
         gecko_profile_interval=1,
         gecko_profile_entries=100000,
         resolution=1,
-        rss=False,
         mainthread=False,
         shutdown=False,
         timeout=3600,
         tpchrome=True,
         tpcycles=10,
         tpmozafterpaint=False,
         fnbpaint=False,
         firstpaint=False,
@@ -212,17 +211,16 @@ DEFAULTS = dict(
 
 
 # keys to generated self.config that are global overrides to tests
 GLOBAL_OVERRIDES = (
     'cycles',
     'gecko_profile',
     'gecko_profile_interval',
     'gecko_profile_entries',
-    'rss',
     'shutdown',
     'tpcycles',
     'tpdelay',
     'tppagecycles',
     'tpmanifest',
     'tptimeout',
     'tpmozafterpaint',
     'fnbpaint',
@@ -311,18 +309,16 @@ def update_prefs(config):
 @validator
 def fix_init_url(config):
     if 'init_url' in config:
         config['init_url'] = convert_url(config, config['init_url'])
 
 
 def get_counters(config):
     counters = set()
-    if config['rss']:
-        counters.add('Main_RSS')
     return counters
 
 
 def get_active_tests(config):
     activeTests = config.pop('activeTests').strip().split(':')
 
     # ensure tests are available
     availableTests = test.test_dict()
--- a/testing/talos/talos/output.py
+++ b/testing/talos/talos/output.py
@@ -211,30 +211,24 @@ class Output(object):
                       sort_keys=True, ignore_nan=True)
 
     def post(self, results, server, path, scheme):
         raise NotImplementedError("Abstract base class")
 
     @classmethod
     def shortName(cls, name):
         """short name for counters"""
-        names = {"Working Set": "memset",
-                 "% Processor Time": "%cpu",
-                 "Private Bytes": "pbytes",
-                 "RSS": "rss",
-                 "XRes": "xres",
-                 "Modified Page List Bytes": "modlistbytes",
-                 "Main_RSS": "main_rss"}
+        names = {"% Processor Time": "%cpu",
+                 "XRes": "xres"}
         return names.get(name, name)
 
     @classmethod
     def isMemoryMetric(cls, resultName):
         """returns if the result is a memory metric"""
-        memory_metric = ['memset', 'rss', 'pbytes', 'xres', 'modlistbytes',
-                         'main_rss', 'content_rss']  # measured in bytes
+        memory_metric = ['xres']  # measured in bytes
         return bool([i for i in memory_metric if i in resultName])
 
     @classmethod
     def v8_Metric(cls, val_list):
         results = [i for i, j in val_list]
         score = 100 * filter.geometric_mean(results)
         return score
 
deleted file mode 100644
--- a/testing/talos/talos/pageloader/chrome/memory.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/* import-globals-from pageloader.js */
-
-var gChildProcess = true;
-var gMemCallback = null;
-
-
-/*
- * Initialize memory collector.  Determine if we have a child process.
- */
-function initializeMemoryCollector(callback, args) {
-    gMemCallback = function() { return callback(args); };
-
-    var os = Components.classes["@mozilla.org/observer-service;1"].
-        getService(Components.interfaces.nsIObserverService);
-
-    os.addObserver(function observer() {
-        var os = Components.classes["@mozilla.org/observer-service;1"].
-            getService(Components.interfaces.nsIObserverService);
-
-        memTimer.cancel();
-        memTimer = null;
-
-        os.removeObserver(observer, "child-memory-reporter-update");
-        os.addObserver(collectAndReport, "child-memory-reporter-update");
-        gMemCallback();
-    }, "child-memory-reporter-update");
-
-   /*
-    * Assume we have a child process, but if timer fires before we call the observer
-    * we will assume there is no child process.
-    */
-    var event = {
-      notify(timer) {
-        memTimer = null;
-        gChildProcess = false;
-        gMemCallback();
-      }
-    }
-
-    var memTimer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
-    memTimer.initWithCallback(event, 10000, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
-
-    os.notifyObservers(null, "child-memory-reporter-request", "generation=1 anonymize=0 minimize=0 DMDident=0");
-}
-
-/*
- * Collect memory from all processes and callback when done collecting.
- */
-function collectMemory(callback, args) {
-  gMemCallback = function() { return callback(args); };
-
-  if (gChildProcess) {
-    var os = Components.classes["@mozilla.org/observer-service;1"].
-        getService(Components.interfaces.nsIObserverService);
-
-    os.notifyObservers(null, "child-memory-reporter-request");
-  } else {
-    collectAndReport(null, null, null);
-  }
-}
-
-function collectAndReport(aSubject, aTopic, aData) {
-  dumpLine(collectRSS());
-  gMemCallback();
-}
-
-function collectRSS() {
-  var mgr = Components.classes["@mozilla.org/memory-reporter-manager;1"].
-      getService(Components.interfaces.nsIMemoryReporterManager);
-  return "RSS: Main: " + mgr.resident + "\n";
-}
-
-/*
- * Cleanup and stop memory collector.
- */
-function stopMemCollector() {
-  if (gChildProcess) {
-    var os = Cc["@mozilla.org/observer-service;1"].
-        getService(Ci.nsIObserverService);
-    os.removeObserver(collectAndReport, "child-memory-reporter-update");
-  }
-}
--- a/testing/talos/talos/pageloader/chrome/pageloader.js
+++ b/testing/talos/talos/pageloader/chrome/pageloader.js
@@ -1,13 +1,12 @@
 /* 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/. */
 
-/* import-globals-from memory.js */
 /* import-globals-from report.js */
 /* eslint mozilla/avoid-Date-timing: "off" */
 
 try {
   if (Cc === undefined) {
     var Cc = Components.classes;
     var Ci = Components.interfaces;
   }
@@ -35,17 +34,16 @@ var start_time;
 var cycle;
 var pageCycle;
 var report;
 var noisy = false;
 var timeout = -1;
 var delay = 250;
 var running = false;
 var forceCC = true;
-var reportRSS = true;
 
 var useMozAfterPaint = false;
 var useFNBPaint = false;
 var gPaintWindow = window;
 var gPaintListener = false;
 var loadNoCache = false;
 var scrollTest = false;
 var gDisableE10S = false;
@@ -149,17 +147,16 @@ function plInit() {
     if (args.width) winWidth = parseInt(args.width);
     if (args.height) winHeight = parseInt(args.height);
     if (args.filter) pageFilterRegexp = new RegExp(args.filter);
     if (args.noisy) noisy = true;
     if (args.timeout) timeout = parseInt(args.timeout);
     if (args.delay) delay = parseInt(args.delay);
     if (args.mozafterpaint) useMozAfterPaint = true;
     if (args.fnbpaint) useFNBPaint = true;
-    if (args.rss) reportRSS = true;
     if (args.loadnocache) loadNoCache = true;
     if (args.scrolltest) scrollTest = true;
     if (args.disableE10S) gDisableE10S = true;
     if (args.profilinginfo) profilingInfo = JSON.parse(args.profilinginfo)
 
     if (profilingInfo) {
       TalosParentProfiler.initFromObject(profilingInfo);
     }
@@ -324,21 +321,17 @@ function plInit() {
           "  }" +
           "} " +
           "addEventListener('load', _contentLoadHandler, true); ";
         content.selectedBrowser.messageManager.loadFrameScript(contentScript, false, true);
         content.selectedBrowser.messageManager.loadFrameScript("chrome://pageloader/content/talos-content.js", false);
         content.selectedBrowser.messageManager.loadFrameScript("chrome://pageloader/content/tscroll.js", false, true);
         content.selectedBrowser.messageManager.loadFrameScript("chrome://pageloader/content/Profiler.js", false, true);
 
-        if (reportRSS) {
-          initializeMemoryCollector(plLoadPage, 100);
-        } else {
-          setTimeout(plLoadPage, 100);
-        }
+        setTimeout(plLoadPage, 100);
       }, 500);
     };
 
     browserWindow.addEventListener("load", browserLoadFunc, true);
   } catch (e) {
     dumpLine("pageloader exception: " + e);
     plStop(true);
   }
@@ -399,21 +392,17 @@ function plLoadPage() {
     if (useFNBPaint) {
       mm.removeMessageListener("PageLoader:FNBPaintError", ContentListener);
     }
   };
   failTimeout.register(loadFail, timeout);
   // record which page we are about to open
   TalosParentProfiler.mark("Opening " + pages[pageIndex].url.pathQueryRef);
 
-  if (reportRSS) {
-    collectMemory(startAndLoadURI, pageName);
-  } else {
-    startAndLoadURI(pageName);
-  }
+  startAndLoadURI(pageName);
 }
 
 function startAndLoadURI(pageName) {
   if (!(plPageFlags() & TEST_DOES_OWN_TIMING)) {
     // Resume the profiler because we're really measuring page load time.
     // If the test is doing its own timing, it'll also need to do its own
     // profiler pausing / resuming.
     TalosParentProfiler.resume("Starting to load URI " + pageName);
@@ -811,21 +800,17 @@ function runRenderTest() {
   for (var j = 0; j < redrawsPerSample; j++)
     wu.redraw();
   var end = Date.now();
 
   renderReport.recordTime(pageIndex, end - start);
 }
 
 function plStop(force) {
-  if (reportRSS) {
-    collectMemory(plStopAll, force);
-  } else {
-    plStopAll(force);
-  }
+  plStopAll(force);
 }
 
 function plStopAll(force) {
   try {
     if (force == false) {
       pageIndex = 0;
       pageCycle = 1;
       if (cycle < NUM_CYCLES - 1) {
@@ -838,20 +823,16 @@ function plStopAll(force) {
       /* output report */
       dumpLine(report.getReport());
       dumpLine(report.getReportSummary());
     }
   } catch (e) {
     dumpLine(e);
   }
 
-  if (reportRSS) {
-    stopMemCollector();
-  }
-
   if (content) {
     content.removeEventListener("load", plLoadHandlerCapturing, true);
     content.removeEventListener("load", plLoadHandler, true);
 
     if (useMozAfterPaint) {
       content.removeEventListener("MozAfterPaint", plPaintedCapturing, true);
       content.removeEventListener("MozAfterPaint", plPainted, true);
     }
--- a/testing/talos/talos/pageloader/chrome/pageloader.xul
+++ b/testing/talos/talos/pageloader/chrome/pageloader.xul
@@ -46,13 +46,12 @@
 
   <script type="application/x-javascript" 
           src="chrome://global/content/globalOverlay.js"/>
   <script type="application/x-javascript" src="chrome://talos-powers-content/content/TalosParentProfiler.js"></script>
   <script type="application/x-javascript" src="MozillaFileLogger.js"></script>
   <script type="application/x-javascript" src="report.js"></script>
   <script type="application/x-javascript" src="pageloader.js"></script>
   <script type="application/x-javascript" src="quit.js"></script>
-  <script type="application/x-javascript" src="memory.js"></script>
 
   <browser id="contentPageloader" src="about:blank" 
     type="content" flex="1"/>
 </window>
--- a/testing/talos/talos/pageloader/components/tp-cmdline.js
+++ b/testing/talos/talos/pageloader/components/tp-cmdline.js
@@ -96,17 +96,16 @@ PageLoaderCmdLineHandler.prototype =
       args.timeout = cmdLine.handleFlagWithParam("tptimeout", false);
       args.delay = cmdLine.handleFlagWithParam("tpdelay", false);
       args.noForceCC = cmdLine.handleFlag("tpnoforcecc", false);
       args.mozafterpaint = cmdLine.handleFlag("tpmozafterpaint", false);
       args.fnbpaint = cmdLine.handleFlag("fnbpaint", false);
       args.loadnocache = cmdLine.handleFlag("tploadnocache", false);
       args.scrolltest = cmdLine.handleFlag("tpscrolltest", false);
       args.disableE10s = cmdLine.handleFlag("tpdisable_e10s", false);
-      args.rss = cmdLine.handleFlag("rss", false);
     } catch (e) {
       return;
     }
 
     let chromeURL = "chrome://pageloader/content/pageloader.xul";
 
     args.wrappedJSObject = args;
     Services.ww.openWindow(null, chromeURL, "_blank",
@@ -131,19 +130,17 @@ 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" +
   "  -tpdelay               Amount of time to wait between each pageload\n" +
   "  -tpnoforcecc           Don't force cycle collection between each pageload\n" +
   "  -tpmozafterpaint       Measure Time after recieving MozAfterPaint event instead of load event\n" +
   "  -fnbpaint  Measure time after a first non-blank paint has occurred\n" +
   "  -tpscrolltest          Unknown\n" +
-  "  -tpdisable_e10s        disable pageloader e10s code path\n" +
-  "  -rss                   Dump RSS after each page is loaded\n"
-
+  "  -tpdisable_e10s        disable pageloader e10s code path\n"
 };
 
 
 var PageLoaderCmdLineFactory =
 {
   createInstance(outer, iid) {
     if (outer != null) {
       throw Components.results.NS_ERROR_NO_AGGREGATION;
--- a/testing/talos/talos/results.py
+++ b/testing/talos/talos/results.py
@@ -280,19 +280,16 @@ class BrowserLogResults(object):
         ('endTime', ('__startAfterTerminationTimestamp',
                      '__endAfterTerminationTimestamp'))
     ]
 
     # regular expression for failure case if we can't parse the tokens
     RESULTS_REGEX_FAIL = re.compile('__FAIL(.*?)__FAIL',
                                     re.DOTALL | re.MULTILINE)
 
-    # regular expression for RSS results
-    RSS_REGEX = re.compile('RSS:\s+([a-zA-Z0-9]+):\s+([0-9]+)$')
-
     # regular expression for responsiveness results
     RESULTS_RESPONSIVENESS_REGEX = re.compile(
         'MOZ_EVENT_TRACE\ssample\s\d*?\s(\d*\.?\d*)$',
         re.DOTALL | re.MULTILINE
     )
 
     # classes for results types
     classes = {'tsformat': TsResults,
@@ -398,19 +395,16 @@ class BrowserLogResults(object):
 
         return self.classes[self.format](self.browser_results)
 
     # methods for counters
 
     def counters(self, counter_results=None, global_counters=None):
         """accumulate all counters"""
 
-        if counter_results is not None:
-            self.rss(counter_results)
-
         if global_counters is not None:
             if 'shutdown' in global_counters:
                 self.shutdown(global_counters)
             if 'responsiveness' in global_counters:
                 global_counters['responsiveness'].extend(self.responsiveness())
             self.xperf(global_counters)
 
     def xperf(self, counter_results):
@@ -487,33 +481,16 @@ class BrowserLogResults(object):
                     continue
                 values = dict(zip(header, row))
                 for i, mainthread_counter in enumerate(mainthread_counters):
                     if int(values[mainthread_counter_keys[i]]) > 0:
                         counter_results.setdefault(mainthread_counter, [])\
                             .append([int(values[mainthread_counter_keys[i]]),
                                      values['filename']])
 
-    def rss(self, counter_results):
-        """record rss counters in counter_results dictionary"""
-
-        counters = ['Main', 'Content']
-        if not set(['%s_RSS' % i for i in counters])\
-                .intersection(counter_results.keys()):
-            # no RSS counters to accumulate
-            return
-        for line in self.results_raw.split('\n'):
-            rssmatch = self.RSS_REGEX.search(line)
-            if rssmatch:
-                (type, value) = (rssmatch.group(1), rssmatch.group(2))
-                # type will be 'Main' or 'Content'
-                counter_name = '%s_RSS' % type
-                if counter_name in counter_results:
-                    counter_results[counter_name].append(value)
-
     def mainthread_io(self, counter_results):
         """record mainthread IO counters in counter_results dictionary"""
 
         # we want to measure mtio on xperf runs.
         # this will be shoved into the xperf results as we ignore those
         SCRIPT_DIR = \
             os.path.abspath(os.path.realpath(os.path.dirname(__file__)))
         filename = os.path.join(SCRIPT_DIR, 'mainthread_io.json')
--- a/testing/talos/talos/run_tests.py
+++ b/testing/talos/talos/run_tests.py
@@ -55,17 +55,17 @@ def buildCommandLine(test):
                  "of cycles, please disregard reported numbers")
         for cycle_var in ['tppagecycles', 'tpcycles', 'cycles']:
             if test[cycle_var] > 2:
                 test[cycle_var] = 2
 
     # build pageloader command from options
     url = ['-tp', test['tpmanifest']]
     CLI_bool_options = ['tpchrome', 'tpmozafterpaint', 'tpdisable_e10s',
-                        'tpnoisy', 'rss', 'tprender', 'tploadnocache',
+                        'tpnoisy', 'tprender', 'tploadnocache',
                         'tpscrolltest', 'fnbpaint']
     CLI_options = ['tpcycles', 'tppagecycles', 'tpdelay', 'tptimeout']
     for key in CLI_bool_options:
         if test.get(key):
             url.append('-%s' % key)
 
     for key in CLI_options:
         value = test.get(key)
--- a/testing/talos/talos/test.py
+++ b/testing/talos/talos/test.py
@@ -139,17 +139,16 @@ class ts_paint(TsBase):
     gecko_profile_startup = True
     gecko_profile_entries = 10000000
     url = 'startup_test/tspaint_test.html'
     shutdown = False
     xperf_counters = []
     win7_counters = []
     filters = filter.ignore_first.prepare(1) + filter.median.prepare()
     tpmozafterpaint = True
-    rss = False
     mainthread = False
     responsiveness = False
     unit = 'ms'
 
 
 @register_test()
 class ts_paint_webext(ts_paint):
     webextensions = '${talos}/webextensions/dummy/dummy-signed.xpi'
@@ -233,17 +232,17 @@ class tresize(TsBase):
 class PageloaderTest(Test):
     """abstract base class for a Talos Pageloader test"""
     tpmanifest = None  # test manifest
     tpcycles = 1  # number of time to run each page
     cycles = None
     timeout = None
     keys = ['tpmanifest', 'tpcycles', 'tppagecycles', 'tprender', 'tpchrome',
             'tpmozafterpaint', 'fnbpaint', 'tploadnocache', 'firstpaint', 'userready',
-            'testeventmap', 'base_vs_ref', 'rss', 'mainthread', 'resolution', 'cycles',
+            'testeventmap', 'base_vs_ref', 'mainthread', 'resolution', 'cycles',
             'gecko_profile', 'gecko_profile_interval', 'gecko_profile_entries',
             'tptimeout', 'win_counters', 'w7_counters', 'linux_counters', 'mac_counters',
             'tpscrolltest', 'xperf_counters', 'timeout', 'shutdown', 'responsiveness',
             'profile_path', 'xperf_providers', 'xperf_user_providers', 'xperf_stackwalk',
             'filters', 'preferences', 'extensions', 'setup', 'cleanup',
             'lower_is_better', 'alert_threshold', 'unit', 'webextensions']
 
 
@@ -510,17 +509,16 @@ class tp5n(PageloaderTest):
     resolution = 20
     shutdown = True
     tpmanifest = '${talos}/tests/tp5n/tp5n.manifest'
     tpcycles = 1
     tppagecycles = 1
     cycles = 1
     tpmozafterpaint = True
     tptimeout = 5000
-    rss = True
     mainthread = True
     w7_counters = []
     win_counters = []
     linux_counters = []
     mac_counters = []
     xperf_counters = ['main_startup_fileio', 'main_startup_netio',
                       'main_normal_fileio', 'main_normal_netio',
                       'nonmain_startup_fileio', 'nonmain_normal_fileio',
@@ -547,24 +545,22 @@ class tp5o(PageloaderTest):
     """
     Derived from the tp5n pageset, this is the 49 most reliable webpages.
     """
     tpcycles = 1
     tppagecycles = 25
     cycles = 1
     tpmozafterpaint = True
     tptimeout = 5000
-    rss = True
     mainthread = False
     tpmanifest = '${talos}/tests/tp5n/tp5o.manifest'
-    win_counters = ['Main_RSS', 'Private Bytes', '% Processor Time']
-    w7_counters = ['Main_RSS', 'Private Bytes', '% Processor Time',
-                   'Modified Page List Bytes']
-    linux_counters = ['Private Bytes', 'XRes', 'Main_RSS']
-    mac_counters = ['Main_RSS']
+    win_counters = ['% Processor Time']
+    w7_counters = ['% Processor Time']
+    linux_counters = ['XRes']
+    mac_counters = []
     responsiveness = True
     gecko_profile_interval = 2
     gecko_profile_entries = 4000000
     filters = filter.ignore_first.prepare(5) + filter.median.prepare()
     timeout = 1800
     unit = 'ms'