diff options
author | Edward Lemur <ehmaldonado@webrtc.org> | 2018-01-15 14:21:09 +0100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2018-01-15 15:24:09 +0000 |
commit | b4017712c5cc04d28eda5e81fc54955d72ecfb26 (patch) | |
tree | 4137a531acc9c8e64ad94346dfe5c5cc3764f758 /audio | |
parent | 44b6762a12a9cfb1f615942baa63668e4423b07d (diff) | |
download | webrtc-b4017712c5cc04d28eda5e81fc54955d72ecfb26.tar.gz |
Store JSON perf results for low_bandwidth_audio_test.
Bug: chromium:755660
Change-Id: I87c19f8dde14772e75f93c723f11408702ca8c8e
Reviewed-on: https://webrtc-review.googlesource.com/39515
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Commit-Queue: Edward Lemur <ehmaldonado@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21615}
Diffstat (limited to 'audio')
-rwxr-xr-x | audio/test/low_bandwidth_audio_test.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/audio/test/low_bandwidth_audio_test.py b/audio/test/low_bandwidth_audio_test.py index 05dcf47f99..9e2597741b 100755 --- a/audio/test/low_bandwidth_audio_test.py +++ b/audio/test/low_bandwidth_audio_test.py @@ -16,6 +16,7 @@ output files will be performed. import argparse import collections +import json import logging import os import re @@ -54,6 +55,8 @@ def _ParseArgs(): parser.add_argument('--android', action='store_true', help='Perform the test on a connected Android device instead.') parser.add_argument('--adb-path', help='Path to adb binary.', default='adb') + parser.add_argument('--chartjson-result-file', + help='Where to store perf results in chartjson format.', default=None) # Ignore Chromium-specific flags parser.add_argument('--isolated-script-test-output', @@ -192,6 +195,15 @@ def _RunPolqa(executable_path, reference_file, degraded_file): return {'polqa_mos_lqo': (mos_lqo, 'score')} +def _AddChart(charts, metric, test_name, value, units): + chart = charts.setdefault(metric, {}) + chart[test_name] = { + "type": "scalar", + "value": value, + "units": units, + } + + Analyzer = collections.namedtuple('Analyzer', ['func', 'executable', 'sample_rate_hz']) @@ -220,6 +232,8 @@ def main(): if polqa_path and _RunPolqa(polqa_path, example_path, example_path): analyzers.append(Analyzer(_RunPolqa, polqa_path, 48000)) + charts = {} + for analyzer in analyzers: # Start the test executable that produces audio files. test_process = subprocess.Popen( @@ -245,6 +259,7 @@ def main(): for metric, (value, units) in analyzer_results.items(): # Output a result for the perf dashboard. print 'RESULT %s: %s= %s %s' % (metric, test_name, value, units) + _AddChart(charts, metric, test_name, value, units) if args.remove: os.remove(reference_file) @@ -252,6 +267,10 @@ def main(): finally: test_process.terminate() + if args.chartjson_result_file: + with open(args.chartjson_result_file, 'w') as f: + json.dump({"format_version": "1.0", "charts": charts}, f) + return test_process.wait() |