OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 | 6 |
7 from telemetry import benchmark | 7 from telemetry import benchmark |
8 from telemetry import page as page_module | 8 from telemetry import page as page_module |
9 from telemetry.core import util | 9 from telemetry.core import util |
10 from telemetry.page import page_set | 10 from telemetry.page import page_set |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 values = [float(v.replace(',', '')) for v in parts[1:-1]] | 91 values = [float(v.replace(',', '')) for v in parts[1:-1]] |
92 units = parts[-1] | 92 units = parts[-1] |
93 metric = page.display_name.split('.')[0].replace('/', '_') | 93 metric = page.display_name.split('.')[0].replace('/', '_') |
94 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 94 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
95 results.current_page, metric, units, values)) | 95 results.current_page, metric, units, values)) |
96 | 96 |
97 break | 97 break |
98 | 98 |
99 print log | 99 print log |
100 | 100 |
| 101 class _BlinkPerfWithPywebsocketMeasurement(_BlinkPerfMeasurement): |
| 102 """Runs a Blink performance test with pywebsocket server.""" |
| 103 run_pywebsocket_server = True |
| 104 |
| 105 def __init__(self): |
| 106 super(_BlinkPerfWithPywebsocketMeasurement, self).__init__() |
| 107 self.needs_pywebsocket_server = True |
| 108 |
| 109 def CustomizeBrowserOptions(self, options): |
| 110 super(_BlinkPerfWithPywebsocketMeasurement, self).CustomizeBrowserOptions( |
| 111 options) |
| 112 # Cross-origin accesses are needed to run benchmarks spanning two servers, |
| 113 # the Telemetry's HTTP server and the pywebsocket server. |
| 114 options.AppendExtraBrowserArgs([ |
| 115 '--disable-web-security' |
| 116 ]) |
| 117 |
101 | 118 |
102 class _BlinkPerfFullFrameMeasurement(_BlinkPerfMeasurement): | 119 class _BlinkPerfFullFrameMeasurement(_BlinkPerfMeasurement): |
103 def __init__(self): | 120 def __init__(self): |
104 super(_BlinkPerfFullFrameMeasurement, self).__init__() | 121 super(_BlinkPerfFullFrameMeasurement, self).__init__() |
105 self._blink_perf_js += '\nwindow.fullFrameMeasurement = true;' | 122 self._blink_perf_js += '\nwindow.fullFrameMeasurement = true;' |
106 | 123 |
107 def CustomizeBrowserOptions(self, options): | 124 def CustomizeBrowserOptions(self, options): |
108 super(_BlinkPerfFullFrameMeasurement, self).CustomizeBrowserOptions( | 125 super(_BlinkPerfFullFrameMeasurement, self).CustomizeBrowserOptions( |
109 options) | 126 options) |
110 # Full layout measurement needs content_shell with internals testing API. | 127 # Full layout measurement needs content_shell with internals testing API. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 242 |
226 # This benchmark is for local testing, doesn't need to run on bots. | 243 # This benchmark is for local testing, doesn't need to run on bots. |
227 @benchmark.Disabled() | 244 @benchmark.Disabled() |
228 class BlinkPerfXMLHttpRequest(benchmark.Benchmark): | 245 class BlinkPerfXMLHttpRequest(benchmark.Benchmark): |
229 tag = 'xml_http_request' | 246 tag = 'xml_http_request' |
230 test = _BlinkPerfMeasurement | 247 test = _BlinkPerfMeasurement |
231 | 248 |
232 def CreatePageSet(self, options): | 249 def CreatePageSet(self, options): |
233 path = os.path.join(BLINK_PERF_BASE_DIR, 'XMLHttpRequest') | 250 path = os.path.join(BLINK_PERF_BASE_DIR, 'XMLHttpRequest') |
234 return CreatePageSetFromPath(path, SKIPPED_FILE) | 251 return CreatePageSetFromPath(path, SKIPPED_FILE) |
| 252 |
| 253 |
| 254 class BlinkPerfPywebsocket(benchmark.Benchmark): |
| 255 tag = 'pywebsocket' |
| 256 test = _BlinkPerfWithPywebsocketMeasurement |
| 257 |
| 258 def CreatePageSet(self, options): |
| 259 path = os.path.join(BLINK_PERF_BASE_DIR, 'Pywebsocket') |
| 260 return CreatePageSetFromPath(path, SKIPPED_FILE) |
OLD | NEW |