Commit d59ff107 authored by Jun Cai's avatar Jun Cai Committed by Caleb Rouleau

Reland: Reland: Network Service: Use histograms instead of chartjsons for...

Reland: 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/+/1456694

New changes in this CL from the above original CL:
The linux-perf-fyi bot failed at:
https://ci.chromium.org/p/chrome/builders/luci.chrome.ci/linux-perf-fyi/1769
And it is because test_results.json is null. This file is generated when
"--output-format=json-test-results" is set. In the above original CL, it uses:
finder_options.output_formats = ['chartjson']
and this removes other entries in the output_formats. This CL keeps the
original finder_options.output_formats while replacing 'histograms' with
'chartjson' when feed it into the story_runner.

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: I1e49a9d3e5e6ff8b085fda6bb2005b79993a4cf1
Reviewed-on: https://chromium-review.googlesource.com/c/1457730Reviewed-by: default avatarJun Cai <juncai@chromium.org>
Reviewed-by: default avatarCaleb Rouleau <crouleau@chromium.org>
Commit-Queue: Jun Cai <juncai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#630110}
parent ac6071e8
...@@ -272,7 +272,7 @@ ...@@ -272,7 +272,7 @@
"--benchmarks=loading.desktop.network_service", "--benchmarks=loading.desktop.network_service",
"-v", "-v",
"--upload-results", "--upload-results",
"--output-format=chartjson", "--output-format=histograms",
"--browser=release" "--browser=release"
], ],
"isolate_name": "performance_test_suite", "isolate_name": "performance_test_suite",
......
...@@ -15,6 +15,8 @@ from telemetry.internal import story_runner ...@@ -15,6 +15,8 @@ from telemetry.internal import story_runner
from telemetry.value import none_values from telemetry.value import none_values
from telemetry.value.list_of_scalar_values import StandardDeviation from telemetry.value.list_of_scalar_values import StandardDeviation
from tracing.value import convert_chart_json
def _ListSubtraction(diff_list, control_list): def _ListSubtraction(diff_list, control_list):
"""Subtract |control_list|'s elements from the corresponding elements in """Subtract |control_list|'s elements from the corresponding elements in
|diff_list|, and store the results in |diff_list|. |diff_list|, and store the results in |diff_list|.
...@@ -157,10 +159,16 @@ class LoadingDesktopNetworkService(loading.LoadingDesktop): ...@@ -157,10 +159,16 @@ class LoadingDesktopNetworkService(loading.LoadingDesktop):
def Run(self, finder_options): def Run(self, finder_options):
"""We shouldn't be overriding this according to """We shouldn't be overriding this according to
telemetry.benchmark.Benchmark""" telemetry.benchmark.Benchmark"""
assert 'chartjson' in finder_options.output_formats, ( assert 'histograms' in finder_options.output_formats, (
'loading.desktop.network_service requires --output-format=chartjson. ' 'loading.desktop.network_service requires --output-format=histograms.')
'Please contact owner to rewrite the benchmark if chartjson is going '
'away.') # feed the story_runner with 'chartjson' output formats.
# TODO(https://crbug.com/929765): Make loading.desktop.network_service
# benchmark produce histograms natively.
while 'histograms' in finder_options.output_formats:
finder_options.output_formats.remove('histograms')
finder_options.output_formats.append('chartjson')
assert finder_options.output_dir assert finder_options.output_dir
output_dir = finder_options.output_dir output_dir = finder_options.output_dir
temp_file_path = os.path.join(output_dir, 'results-chart.json') temp_file_path = os.path.join(output_dir, 'results-chart.json')
...@@ -198,6 +206,17 @@ class LoadingDesktopNetworkService(loading.LoadingDesktop): ...@@ -198,6 +206,17 @@ class LoadingDesktopNetworkService(loading.LoadingDesktop):
with open(temp_file_path, 'w') as f: with open(temp_file_path, 'w') as f:
json.dump(enabled_chart_json, f, indent=2, separators=(',', ': ')) json.dump(enabled_chart_json, f, indent=2, separators=(',', ': '))
f.write('\n') 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 return 0
def SetExtraBrowserOptions(self, options): 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