Bug 1526505 - Update mozharness stats parsing code for per-language stats. r=firefox-build-system-reviewers,ted
authorChris Manchester <cmanchester@mozilla.com>
Mon, 11 Feb 2019 13:39:21 +0000
changeset 458553 9cc8cc20982cd58a92d6f220b9d8874adf62467f
parent 458552 6f44a6959199fb72e0670cda172638a77800b66d
child 458554 6f1ebd9774c73cec51dd3af144d48e82e4cdb1df
push id77908
push usercmanchester@mozilla.com
push dateMon, 11 Feb 2019 20:02:08 +0000
treeherderautoland@9cc8cc20982c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfirefox-build-system-reviewers, ted
bugs1526505
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1526505 - Update mozharness stats parsing code for per-language stats. r=firefox-build-system-reviewers,ted Differential Revision: https://phabricator.services.mozilla.com/D19247
testing/mozharness/mozharness/mozilla/building/buildbase.py
--- a/testing/mozharness/mozharness/mozilla/building/buildbase.py
+++ b/testing/mozharness/mozharness/mozilla/building/buildbase.py
@@ -1389,18 +1389,26 @@ or run without that action (ie: --no-{ac
         )
         if not os.path.exists(stats_file):
             self.info('%s does not exist; not loading sccache stats' % stats_file)
             return
 
         with open(stats_file, 'rb') as fh:
             stats = json.load(fh)
 
-        total = stats['stats']['requests_executed']
-        hits = stats['stats']['cache_hits']
+        def get_stat(key):
+            val = stats['stats'][key]
+            # Future versions of sccache will distinguish stats by language
+            # and store them as a dict.
+            if isinstance(val, dict):
+                val = sum(val['counts'].values())
+            return val
+
+        total = get_stat('requests_executed')
+        hits = get_stat('cache_hits')
         if total > 0:
             hits /= float(total)
 
         yield {
             'name': 'sccache hit rate',
             'value': hits,
             'extraOptions': self.perfherder_resource_options(),
             'subtests': [],