Bug 1471650 - Profile WebRender threads in talos if WebRender is enabled. r?jmaher draft
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 10 Jul 2018 07:45:08 -0400
changeset 815941 f1c2348e059fdad710189326d39269675a5a6d30
parent 815592 3d20b0701781731e0f9b08e1cd40ac842f385e03
push id115699
push userkgupta@mozilla.com
push dateTue, 10 Jul 2018 11:45:34 +0000
reviewersjmaher
bugs1471650
milestone63.0a1
Bug 1471650 - Profile WebRender threads in talos if WebRender is enabled. r?jmaher MozReview-Commit-ID: DriYeGhqvIZ
testing/talos/talos/ffsetup.py
testing/talos/talos/gecko_profile.py
--- a/testing/talos/talos/ffsetup.py
+++ b/testing/talos/talos/ffsetup.py
@@ -196,17 +196,18 @@ class FFSetup(object):
     def _init_gecko_profile(self):
         upload_dir = os.getenv('MOZ_UPLOAD_DIR')
         if self.test_config.get('gecko_profile') and not upload_dir:
             LOG.critical("Profiling ignored because MOZ_UPLOAD_DIR was not"
                          " set")
         if upload_dir and self.test_config.get('gecko_profile'):
             self.gecko_profile = GeckoProfile(upload_dir,
                                               self.browser_config,
-                                              self.test_config)
+                                              self.test_config,
+                                              str(os.getenv('MOZ_WEBRENDER')) == '1')
             self.gecko_profile.update_env(self.env)
 
     def clean(self):
         try:
             mozfile.remove(self._tmp_dir)
         except Exception as e:
             LOG.info("Exception while removing profile directory: %s" % self._tmp_dir)
             LOG.info(e)
--- a/testing/talos/talos/gecko_profile.py
+++ b/testing/talos/talos/gecko_profile.py
@@ -20,29 +20,31 @@ LOG = get_proxy_logger()
 
 
 class GeckoProfile(object):
     """
     Handle Gecko profilling.
 
     This allow to collect Gecko profiling data and to zip results in one file.
     """
-    def __init__(self, upload_dir, browser_config, test_config):
+    def __init__(self, upload_dir, browser_config, test_config, webrender_enabled):
         self.upload_dir = upload_dir
         self.browser_config, self.test_config = browser_config, test_config
         self.cleanup = True
 
         # Create a temporary directory into which the tests can put
         # their profiles. These files will be assembled into one big
         # zip file later on, which is put into the MOZ_UPLOAD_DIR.
         gecko_profile_dir = tempfile.mkdtemp()
 
         gecko_profile_interval = test_config.get('gecko_profile_interval', 1)
         gecko_profile_entries = test_config.get('gecko_profile_entries', 1000000)
         gecko_profile_threads = 'GeckoMain,Compositor'
+        if webrender_enabled:
+            gecko_profile_threads += ',WR,Renderer'
 
         # Make sure no archive already exists in the location where
         # we plan to output our profiler archive
         self.profile_arcname = os.path.join(
             self.upload_dir,
             "profile_{0}.zip".format(test_config['name'])
         )
         LOG.info("Clearing archive {0}".format(self.profile_arcname))
@@ -77,17 +79,18 @@ class GeckoProfile(object):
         if not self.test_config.get('gecko_profile_startup'):
             return
         # Set environment variables which will cause profiling to
         # start as early as possible. These are consumed by Gecko
         # itself, not by Talos JS code.
         env.update({
             'MOZ_PROFILER_STARTUP': '1',
             'MOZ_PROFILER_STARTUP_INTERVAL': str(self.option('interval')),
-            'MOZ_PROFILER_STARTUP_ENTRIES': str(self.option('entries'))
+            'MOZ_PROFILER_STARTUP_ENTRIES': str(self.option('entries')),
+            'MOZ_PROFILER_STARTUP_FILTERS': str(self.option('threads'))
         })
 
     def _save_gecko_profile(self, cycle, symbolicator, missing_symbols_zip,
                             profile_path):
         try:
             with open(profile_path, 'r') as profile_file:
                 profile = json.load(profile_file)
             symbolicator.dump_and_integrate_missing_symbols(