Changeset 125332 in webkit
- Timestamp:
- Aug 10, 2012 3:17:57 PM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r125320 r125332 1 2012-08-10 Ryosuke Niwa <rniwa@webkit.org> 2 3 run-perf-tests should upload memory statistics to perf-o-matic 4 https://bugs.webkit.org/show_bug.cgi?id=93690 5 6 Reviewed by Dirk Pranke. 7 8 Upload JS Heap and FastMalloc results for a test X/Y as: X/Y:JSHeap and X/Y:FastMalloc. 9 Note "JS Heap" is converted to the CamelCase JSHeap. 10 11 Also did some refactoring in PerfTest.parse_output and PerfTestRunnerTest and updated 12 some helps in PerfTest.parse_output per arv's comments. 13 14 * Scripts/webkitpy/performance_tests/perftest.py: 15 (PerfTest): 16 (PerfTest.parse_output): Include JSHeap and FastMalloc statistics in results as well as of Time. 17 Also refactored it to avoid hard-coding indices in _result_classes and moved complied regular 18 exressions out of the function to avoid re-compiling them every time the method runs. 19 (PerfTest.output_statistics): Convert ':' to ': ' as well as '/'. 20 (ChromiumStylePerfTest.parse_output): Removed an unused variable. 21 * Scripts/webkitpy/performance_tests/perftestsrunner.py: 22 (PerfTestsRunner._parse_args): Uploaded some helps per arv's feedback. 23 (PerfTestsRunner._output_json_path): Extracted from _generate_and_show_results to be used in 24 PerfTestRunnerTest.create_runner. 25 (PerfTestsRunner._generate_and_show_results): 26 * Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py: 27 (create_runner): Extracted runner.load_output_json from various tests. 28 (test_run_memory_test): Added. 29 (PerfTestRunner): Extracted _event_target_wrapper_and_inspector_results from various tests. 30 (test_run_with_json_output): 31 (test_run_with_description): 32 (test_run_generates_json_by_default): 33 (test_run_generates_and_show_results_page): 34 (test_run_with_json_source): 35 (test_run_with_multiple_repositories): 36 1 37 2012-08-10 Benjamin Poulain <bpoulain@apple.com> 2 38 -
trunk/Tools/Scripts/webkitpy/performance_tests/perftest.py
r125188 r125332 112 112 return False 113 113 114 _description_regex = re.compile(r'^Description: (?P<description>.*)$', re.IGNORECASE) 115 _result_classes = ['Time', 'JS Heap', 'FastMalloc'] 116 _result_class_regex = re.compile(r'^(?P<resultclass>' + r'|'.join(_result_classes) + '):') 114 117 _statistics_keys = ['avg', 'median', 'stdev', 'min', 'max', 'unit'] 115 _ result_classes = ['Time:', 'JS Heap:', 'FastMalloc:']118 _score_regex = re.compile(r'^(?P<key>' + r'|'.join(_statistics_keys) + r')\s+(?P<value>[0-9\.]+)\s*(?P<unit>.*)') 116 119 117 120 def parse_output(self, output): 118 got_a_result = False119 121 test_failed = False 120 results = dict([(name, dict()) for name in self._result_classes])121 score_regex = re.compile(r'^(?P<key>' + r'|'.join(self._statistics_keys) + r')\s+(?P<value>[0-9\.]+)\s*(?P<unit>.*)')122 description_regex = re.compile(r'^Description: (?P<description>.*)$', re.IGNORECASE)122 results = {} 123 ordered_results_keys = [] 124 test_name = re.sub(r'\.\w+$', '', self._test_name) 123 125 description_string = "" 124 result_class_regex = re.compile(r'^(?P<resultclass>' + r'|'.join(self._result_classes) + ')')125 126 126 result_class = "" 127 127 for line in re.split('\n', output.text): 128 description = description_regex.match(line)128 description = self._description_regex.match(line) 129 129 if description: 130 130 description_string = description.group('description') 131 131 continue 132 132 133 result_class_match = result_class_regex.match(line)133 result_class_match = self._result_class_regex.match(line) 134 134 if result_class_match: 135 135 result_class = result_class_match.group('resultclass') 136 136 continue 137 137 138 score = s core_regex.match(line)138 score = self._score_regex.match(line) 139 139 if score: 140 140 key = score.group('key') 141 141 value = float(score.group('value')) 142 142 unit = score.group('unit') 143 results[result_class]['unit'] = unit 144 results[result_class][key] = value 143 name = test_name 144 if result_class != 'Time': 145 name += ':' + result_class.replace(' ', '') 146 if name not in ordered_results_keys: 147 ordered_results_keys.append(name) 148 results.setdefault(name, {}) 149 results[name]['unit'] = unit 150 results[name][key] = value 145 151 continue 146 152 … … 149 155 _log.error(line) 150 156 151 if test_failed or set(self._statistics_keys) != set(results[ self._result_classes[0]].keys()):157 if test_failed or set(self._statistics_keys) != set(results[test_name].keys()): 152 158 return None 153 159 154 test_name = re.sub(r'\.\w+$', '', self._test_name)155 self.output_statistics(test_name, results[self._result_classes[0]], description_string)156 if results[self._result_classes[1]] and results[self._result_classes[2]]:157 self.output_statistics(test_name + "/JSHeap", results[self._result_classes[1]])158 self.output_statistics(test_name + "/FastMalloc", results[self._result_classes[2]])159 return {test_name: results['Time:']}160 for result_name in ordered_results_keys: 161 if result_name == test_name: 162 self.output_statistics(result_name, results[result_name], description_string) 163 else: 164 self.output_statistics(result_name, results[result_name]) 165 return results 160 166 161 167 def output_statistics(self, test_name, results, description_string=None): … … 163 169 if description_string: 164 170 _log.info('DESCRIPTION: %s' % description_string) 165 _log.info('RESULT %s= %s %s' % (test_name.replace(' /', ': '), results['avg'], unit))171 _log.info('RESULT %s= %s %s' % (test_name.replace(':', ': ').replace('/', ': '), results['avg'], unit)) 166 172 _log.info(', '.join(['%s= %s %s' % (key, results[key], unit) for key in self._statistics_keys[1:5]])) 167 173 … … 175 181 def parse_output(self, output): 176 182 test_failed = False 177 got_a_result = False178 183 results = {} 179 184 for line in re.split('\n', output.text): -
trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py
r124949 r125332 100 100 help="Do no generate results JSON and results page."), 101 101 optparse.make_option("--output-json-path", 102 help=" Filename of the JSON file that summaries the results."),102 help="Path to generate a JSON file at; may contain previous results if it already exists."), 103 103 optparse.make_option("--source-json-path", 104 help=" Path to a JSON file to be merged into the JSON file when --output-json-path is present."),104 help="Only used on bots. Path to a JSON file to be merged into the JSON file when --output-json-path is present."), 105 105 optparse.make_option("--description", 106 106 help="Add a description to the output JSON file if one is generated"), … … 169 169 return unexpected 170 170 171 def _output_json_path(self): 172 output_json_path = self._options.output_json_path 173 if output_json_path: 174 return output_json_path 175 return self._host.filesystem.join(self._port.perf_results_directory(), self._DEFAULT_JSON_FILENAME) 176 171 177 def _generate_and_show_results(self): 172 178 options = self._options 173 output_json_path = options.output_json_path 174 if not output_json_path: 175 output_json_path = self._host.filesystem.join(self._port.perf_results_directory(), self._DEFAULT_JSON_FILENAME) 176 179 output_json_path = self._output_json_path() 177 180 output = self._generate_results_dict(self._timestamp, options.description, options.platform, options.builder_name, options.build_number) 178 181 -
trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py
r125188 r125332 106 106 max 1120 ms 107 107 """ 108 elif driver_input.test_name.endswith('memory-test.html'): 109 text = """Running 20 times 110 Ignoring warm-up run (1115) 111 112 Time: 113 avg 1100 ms 114 median 1101 ms 115 stdev 11 ms 116 min 1080 ms 117 max 1120 ms 118 119 JS Heap: 120 avg 832000 bytes 121 median 829000 bytes 122 stdev 15000 bytes 123 min 811000 bytes 124 max 848000 bytes 125 126 FastMalloc: 127 avg 532000 bytes 128 median 529000 bytes 129 stdev 13000 bytes 130 min 511000 bytes 131 max 548000 bytes 132 """ 108 133 return DriverOutput(text, '', '', '', crash=crash, timeout=timeout) 109 134 … … 123 148 runner._host.filesystem.maybe_make_directory(runner._base_path, 'Bindings') 124 149 runner._host.filesystem.maybe_make_directory(runner._base_path, 'Parser') 150 151 filesystem = runner._host.filesystem 152 runner.load_output_json = lambda: json.loads(filesystem.read_text_file(runner._output_json_path())) 125 153 return runner, test_port 126 154 … … 228 256 '', ''])) 229 257 258 def test_run_memory_test(self): 259 runner, port = self.create_runner_and_setup_results_template() 260 runner._timestamp = 123456789 261 port.host.filesystem.write_text_file(runner._base_path + '/Parser/memory-test.html', 'some content') 262 263 output = OutputCapture() 264 output.capture_output() 265 try: 266 unexpected_result_count = runner.run() 267 finally: 268 stdout, stderr, log = output.restore_output() 269 self.assertEqual(unexpected_result_count, 0) 270 self.assertEqual(log, '\n'.join([ 271 'Running 1 tests', 272 'Running Parser/memory-test.html (1 of 1)', 273 'RESULT Parser: memory-test= 1100.0 ms', 274 'median= 1101.0 ms, stdev= 11.0 ms, min= 1080.0 ms, max= 1120.0 ms', 275 'RESULT Parser: memory-test: JSHeap= 832000.0 bytes', 276 'median= 829000.0 bytes, stdev= 15000.0 bytes, min= 811000.0 bytes, max= 848000.0 bytes', 277 'RESULT Parser: memory-test: FastMalloc= 532000.0 bytes', 278 'median= 529000.0 bytes, stdev= 13000.0 bytes, min= 511000.0 bytes, max= 548000.0 bytes', 279 '', ''])) 280 results = runner.load_output_json()[0]['results'] 281 self.assertEqual(results['Parser/memory-test'], {'min': 1080.0, 'max': 1120.0, 'median': 1101.0, 'stdev': 11.0, 'avg': 1100.0, 'unit': 'ms'}) 282 self.assertEqual(results['Parser/memory-test:JSHeap'], {'min': 811000.0, 'max': 848000.0, 'median': 829000.0, 'stdev': 15000.0, 'avg': 832000.0, 'unit': 'bytes'}) 283 self.assertEqual(results['Parser/memory-test:FastMalloc'], {'min': 511000.0, 'max': 548000.0, 'median': 529000.0, 'stdev': 13000.0, 'avg': 532000.0, 'unit': 'bytes'}) 284 230 285 def _test_run_with_json_output(self, runner, filesystem, upload_suceeds=True, expected_exit_code=0): 231 286 filesystem.write_text_file(runner._base_path + '/inspector/pass.html', 'some content') … … 263 318 return uploaded[0] 264 319 320 _event_target_wrapper_and_inspector_results = { 321 "Bindings/event-target-wrapper": {"max": 1510, "avg": 1489.05, "median": 1487, "min": 1471, "stdev": 14.46, "unit": "ms"}, 322 "inspector/pass.html:group_name:test_name": 42} 323 265 324 def test_run_with_json_output(self): 266 325 runner, port = self.create_runner(args=['--output-json-path=/mock-checkout/output.json', 267 326 '--test-results-server=some.host']) 268 327 self._test_run_with_json_output(runner, port.host.filesystem) 269 self.assertEqual(json.loads(port.host.filesystem.read_text_file('/mock-checkout/output.json')), { 270 "timestamp": 123456789, "results": 271 {"Bindings/event-target-wrapper": {"max": 1510, "avg": 1489.05, "median": 1487, "min": 1471, "stdev": 14.46, "unit": "ms"}, 272 "inspector/pass.html:group_name:test_name": 42}, 328 self.assertEqual(runner.load_output_json(), { 329 "timestamp": 123456789, "results": self._event_target_wrapper_and_inspector_results, 273 330 "webkit-revision": "5678", "branch": "webkit-trunk"}) 274 331 … … 277 334 '--test-results-server=some.host', '--description', 'some description']) 278 335 self._test_run_with_json_output(runner, port.host.filesystem) 279 self.assertEqual(json.loads(port.host.filesystem.read_text_file('/mock-checkout/output.json')), { 280 "timestamp": 123456789, "description": "some description", "results": 281 {"Bindings/event-target-wrapper": {"max": 1510, "avg": 1489.05, "median": 1487, "min": 1471, "stdev": 14.46, "unit": "ms"}, 282 "inspector/pass.html:group_name:test_name": 42}, 336 self.assertEqual(runner.load_output_json(), { 337 "timestamp": 123456789, "description": "some description", 338 "results": self._event_target_wrapper_and_inspector_results, 283 339 "webkit-revision": "5678", "branch": "webkit-trunk"}) 284 340 … … 310 366 311 367 self.assertEqual(json.loads(port.host.filesystem.read_text_file(output_json_path)), [{ 312 "timestamp": 123456789, "results": 313 {"Bindings/event-target-wrapper": {"max": 1510, "avg": 1489.05, "median": 1487, "min": 1471, "stdev": 14.46, "unit": "ms"}, 314 "inspector/pass.html:group_name:test_name": 42}, 368 "timestamp": 123456789, "results": self._event_target_wrapper_and_inspector_results, 315 369 "webkit-revision": "5678", "branch": "webkit-trunk"}]) 316 370 … … 325 379 self._test_run_with_json_output(runner, filesystem) 326 380 327 expected_entry = {"timestamp": 123456789, "results": {"Bindings/event-target-wrapper": 328 {"max": 1510, "avg": 1489.05, "median": 1487, "min": 1471, "stdev": 14.46, "unit": "ms"}, 329 "inspector/pass.html:group_name:test_name": 42}, "webkit-revision": "5678", "branch": "webkit-trunk"} 381 expected_entry = {"timestamp": 123456789, "results": self._event_target_wrapper_and_inspector_results, 382 "webkit-revision": "5678", "branch": "webkit-trunk"} 330 383 331 384 self.maxDiff = None … … 372 425 port.host.filesystem.write_text_file('/mock-checkout/source.json', '{"key": "value"}') 373 426 self._test_run_with_json_output(runner, port.host.filesystem) 374 self.assertEqual(json.loads(port.host.filesystem.files['/mock-checkout/output.json']), { 375 "timestamp": 123456789, "results": 376 {"Bindings/event-target-wrapper": {"max": 1510, "avg": 1489.05, "median": 1487, "min": 1471, "stdev": 14.46, "unit": "ms"}, 377 "inspector/pass.html:group_name:test_name": 42}, 378 "webkit-revision": "5678", "branch": "webkit-trunk", 379 "key": "value"}) 427 self.assertEqual(runner.load_output_json(), { 428 "timestamp": 123456789, "results": self._event_target_wrapper_and_inspector_results, 429 "webkit-revision": "5678", "branch": "webkit-trunk", "key": "value"}) 380 430 381 431 def test_run_with_bad_json_source(self): … … 393 443 port.repository_paths = lambda: [('webkit', '/mock-checkout'), ('some', '/mock-checkout/some')] 394 444 self._test_run_with_json_output(runner, port.host.filesystem) 395 self.assertEqual(json.loads(port.host.filesystem.files['/mock-checkout/output.json']), { 396 "timestamp": 123456789, "results": 397 {"Bindings/event-target-wrapper": {"max": 1510, "avg": 1489.05, "median": 1487, "min": 1471, "stdev": 14.46, "unit": "ms"}, 398 "inspector/pass.html:group_name:test_name": 42.0}, 445 self.assertEqual(runner.load_output_json(), { 446 "timestamp": 123456789, "results": self._event_target_wrapper_and_inspector_results, 399 447 "webkit-revision": "5678", "some-revision": "5678", "branch": "webkit-trunk"}) 400 448
Note: See TracChangeset
for help on using the changeset viewer.