Commit 39f4f1ec authored by bsheedy's avatar bsheedy Committed by Commit Bot

Add histogram support to sizes.py

Adds the --output-dir option to sizes.py, which specifies a directory to
dump collected data to in the HistogramSet format. This is the first
step to getting the sizes step working on LUCI, which can't use the
older CharJSON data format for uploading due to it being tied to IP
whitelisting for authentication.

Bug: 906685
Change-Id: Ic4169c34c20d456144af5b15e50acb303affed4c
Reviewed-on: https://chromium-review.googlesource.com/c/1343344Reviewed-by: default avatarBen Hayden <benjhayden@chromium.org>
Reviewed-by: default avatarHans Wennborg <hans@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610970}
parent b9f402c5
...@@ -29,6 +29,11 @@ from slave import build_directory ...@@ -29,6 +29,11 @@ from slave import build_directory
SRC_DIR = os.path.abspath( SRC_DIR = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..', '..')) os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..', '..'))
# Add Catapult to the path so we can import the chartjson-histogramset
# conversion.
sys.path.append(os.path.join(SRC_DIR, 'third_party', 'catapult', 'tracing'))
from tracing.value import convert_chart_json
# If something adds a static initializer, revert it, don't increase these # If something adds a static initializer, revert it, don't increase these
# numbers. We don't accept regressions in static initializers. # numbers. We don't accept regressions in static initializers.
# #
...@@ -569,6 +574,12 @@ def main(): ...@@ -569,6 +574,12 @@ def main():
option_parser.add_option('--json', help='Path to JSON output file') option_parser.add_option('--json', help='Path to JSON output file')
option_parser.add_option('--failures', option_parser.add_option('--failures',
help='Path to JSON output file for failures') help='Path to JSON output file for failures')
# This needs to be --output-dir (and not something like --output-directory) in
# order to work properly with the build-side runtest.py script that's
# currently used for dashboard uploading results from this script.
option_parser.add_option('--output-dir',
help='Directory to dump data in the HistogramSet '
'format')
options, args = option_parser.parse_args() options, args = option_parser.parse_args()
...@@ -589,6 +600,18 @@ def main(): ...@@ -589,6 +600,18 @@ def main():
with open(options.json, 'w') as f: with open(options.json, 'w') as f:
json.dump(results_collector.results, f) json.dump(results_collector.results, f)
if options.output_dir:
histogram_path = os.path.join(options.output_dir, 'perf_results.json')
with open(histogram_path, 'w') as f:
json.dump(results_collector.results, f)
histogram_result = convert_chart_json.ConvertChartJson(histogram_path)
if histogram_result.returncode != 0:
sys.stderr.write(
'chartjson conversion failed: %s\n' % histogram_result.stdout)
return histogram_result.returncode
with open(histogram_path, 'w') as f:
f.write(histogram_result.stdout)
if options.failures: if options.failures:
with open(options.failures, 'w') as f: with open(options.failures, 'w') as f:
json.dump(results_collector.failures, f) json.dump(results_collector.failures, f)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment