Commit 9e95fd2b authored by Jun Cai's avatar Jun Cai Committed by Commit Bot

Reland: Network Service: Use histograms instead of chartjsons for network service performance tests

The initial upload of this CL is the same as:
https://chromium-review.googlesource.com/c/chromium/src/+/1454633

New changes in the CL from the above original CL:
Modifies the output histogram filename to be "histograms.json"

This CL modifies the network service performance tests to generate
histograms instead of chartjsons so that the Pinpoint can automatic
bisect CLs.

TBR=crouleau@chromium.org, jam@chromium.org, simonhatch@chromium.org, benjhayden@chromium.org

Bug: 927155
Change-Id: I7b9dcd9fdabe7b5e59d7d5143b1ec1e2ffd9606e
Reviewed-on: https://chromium-review.googlesource.com/c/1456694Reviewed-by: default avatarJun Cai <juncai@chromium.org>
Reviewed-by: default avatarSimon Hatch <simonhatch@chromium.org>
Commit-Queue: Jun Cai <juncai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#629755}
parent d8c5318d
......@@ -272,7 +272,7 @@
"--benchmarks=loading.desktop.network_service",
"-v",
"--upload-results",
"--output-format=chartjson",
"--output-format=histograms",
"--browser=release"
],
"isolate_name": "performance_test_suite",
......
......@@ -15,6 +15,8 @@ from telemetry.internal import story_runner
from telemetry.value import none_values
from telemetry.value.list_of_scalar_values import StandardDeviation
from tracing.value import convert_chart_json
def _ListSubtraction(diff_list, control_list):
"""Subtract |control_list|'s elements from the corresponding elements in
|diff_list|, and store the results in |diff_list|.
......@@ -157,10 +159,12 @@ class LoadingDesktopNetworkService(loading.LoadingDesktop):
def Run(self, finder_options):
"""We shouldn't be overriding this according to
telemetry.benchmark.Benchmark"""
assert 'chartjson' in finder_options.output_formats, (
'loading.desktop.network_service requires --output-format=chartjson. '
'Please contact owner to rewrite the benchmark if chartjson is going '
'away.')
assert 'histograms' in finder_options.output_formats, (
'loading.desktop.network_service requires --output-format=histograms.')
# feed the story_runner with 'chartjson' output formats.
finder_options.output_formats = ['chartjson']
assert finder_options.output_dir
output_dir = finder_options.output_dir
temp_file_path = os.path.join(output_dir, 'results-chart.json')
......@@ -198,6 +202,17 @@ class LoadingDesktopNetworkService(loading.LoadingDesktop):
with open(temp_file_path, 'w') as f:
json.dump(enabled_chart_json, f, indent=2, separators=(',', ': '))
f.write('\n')
logging.info('Converting chartjsons to histograms')
histogram_result = convert_chart_json.ConvertChartJson(temp_file_path)
if histogram_result.returncode != 0:
logging.error('Error converting chart json to Histograms:\n' +
histogram_result.stdout)
return 1
temp_file_path = os.path.join(output_dir, 'histograms.json')
with open(temp_file_path, 'w') as f:
f.write(histogram_result.stdout)
return 0
def SetExtraBrowserOptions(self, options):
......
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