From 620bed1c71a4ce42bb00307a416e54e5a2c62ad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20H=C3=B6glund?= Date: Tue, 17 Mar 2020 09:59:10 +0100 Subject: [PATCH] Remove allbins and story hacks, fix -Infinity. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The problem that has stopped the uploads from working is likely that json.dump writes -Infinity when encountering float('-inf'), but not all JSON parsers handle that. Notably, the dashboard JSON library doesn't when running in compressing mode. I think the real fix is to land the float->double CL for the histogram proto - I think we will not get float('inf') values then. Apply this hack in the meantime. Also remove allbins and story hacks, they're likely worse than the defaults anyway. Bug: chromium:1029452 Tbr: mbonadei@webrtc.org Change-Id: I98e36307cc144bbe6878ba9d93c0a609cab71418 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170626 Reviewed-by: Patrik Höglund Cr-Commit-Position: refs/heads/master@{#30808} --- tools_webrtc/perf/catapult_uploader.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tools_webrtc/perf/catapult_uploader.py b/tools_webrtc/perf/catapult_uploader.py index 4d5ff88f65..96d1080d45 100644 --- a/tools_webrtc/perf/catapult_uploader.py +++ b/tools_webrtc/perf/catapult_uploader.py @@ -13,6 +13,7 @@ import json import subprocess import zlib +from tracing.value import histogram from tracing.value import histogram_set from tracing.value.diagnostics import generic_set from tracing.value.diagnostics import reserved_infos @@ -58,14 +59,17 @@ def _SendHistogramSet(url, histograms, oauth_token): # TODO(https://crbug.com/1029452): HACKHACK -# Remove once we set bin bounds correctly in the proto writer. +# Remove once we have doubles in the proto and handle -infinity correctly. def _ApplyHacks(dicts): for d in dicts: - if 'name' in d: - d['allBins'] = [[1]] - del d['binBoundaries'] - d['diagnostics']['stories']['values'][0] = ( - d['diagnostics']['stories']['values'][0].replace('/', '_')) + if 'running' in d: + def _NoInf(value): + if value == float('inf'): + return histogram.JS_MAX_VALUE + if value == float('-inf'): + return -histogram.JS_MAX_VALUE + return value + d['running'] = [_NoInf(value) for value in d['running']] return dicts @@ -101,8 +105,8 @@ def _DumpOutput(histograms, output_file): # TODO(https://crbug.com/1029452): Remove this once # https://chromium-review.googlesource.com/c/catapult/+/2094312 lands. def _HackSummaryOptions(histograms): - for histogram in histograms: - histogram.CustomizeSummaryOptions({ + for h in histograms: + h.CustomizeSummaryOptions({ 'avg': False, 'std': False, 'count': False,