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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Chris Manchester 2019-02-11 13:39:21 +00:00
Родитель cbb252c256
Коммит 2f48be1ec4
1 изменённых файлов: 10 добавлений и 2 удалений

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

@ -1394,8 +1394,16 @@ or run without that action (ie: --no-{action})"
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)