Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: tools/run_perf.py

Issue 811483008: Make perf test runner more robust. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/unittests/run_perf_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 the V8 project authors. All rights reserved. 2 # Copyright 2014 the V8 project authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """ 6 """
7 Performance runner for d8. 7 Performance runner for d8.
8 8
9 Call e.g. with tools/run-perf.py --arch ia32 some_suite.json 9 Call e.g. with tools/run-perf.py --arch ia32 some_suite.json
10 10
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 """ 258 """
259 def __init__(self, suite, parent, arch): 259 def __init__(self, suite, parent, arch):
260 super(Trace, self).__init__(suite, parent, arch) 260 super(Trace, self).__init__(suite, parent, arch)
261 assert self.results_regexp 261 assert self.results_regexp
262 self.results = [] 262 self.results = []
263 self.errors = [] 263 self.errors = []
264 self.stddev = "" 264 self.stddev = ""
265 265
266 def ConsumeOutput(self, stdout): 266 def ConsumeOutput(self, stdout):
267 try: 267 try:
268 self.results.append( 268 result = re.search(self.results_regexp, stdout, re.M).group(1)
269 re.search(self.results_regexp, stdout, re.M).group(1)) 269 self.results.append(str(float(result)))
270 except ValueError:
271 self.errors.append("Regexp \"%s\" returned a non-numeric for test %s."
272 % (self.results_regexp, self.graphs[-1]))
270 except: 273 except:
271 self.errors.append("Regexp \"%s\" didn't match for test %s." 274 self.errors.append("Regexp \"%s\" didn't match for test %s."
272 % (self.results_regexp, self.graphs[-1])) 275 % (self.results_regexp, self.graphs[-1]))
273 276
274 try: 277 try:
275 if self.stddev_regexp and self.stddev: 278 if self.stddev_regexp and self.stddev:
276 self.errors.append("Test %s should only run once since a stddev " 279 self.errors.append("Test %s should only run once since a stddev "
277 "is provided by the test." % self.graphs[-1]) 280 "is provided by the test." % self.graphs[-1])
278 if self.stddev_regexp: 281 if self.stddev_regexp:
279 self.stddev = re.search(self.stddev_regexp, stdout, re.M).group(1) 282 self.stddev = re.search(self.stddev_regexp, stdout, re.M).group(1)
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 for line in stdout.strip().splitlines(): 370 for line in stdout.strip().splitlines():
368 match = GENERIC_RESULTS_RE.match(line) 371 match = GENERIC_RESULTS_RE.match(line)
369 if match: 372 if match:
370 stddev = "" 373 stddev = ""
371 graph = match.group(1) 374 graph = match.group(1)
372 trace = match.group(2) 375 trace = match.group(2)
373 body = match.group(3) 376 body = match.group(3)
374 units = match.group(4) 377 units = match.group(4)
375 match_stddev = RESULT_STDDEV_RE.match(body) 378 match_stddev = RESULT_STDDEV_RE.match(body)
376 match_list = RESULT_LIST_RE.match(body) 379 match_list = RESULT_LIST_RE.match(body)
380 errors = []
377 if match_stddev: 381 if match_stddev:
378 result, stddev = map(str.strip, match_stddev.group(1).split(",")) 382 result, stddev = map(str.strip, match_stddev.group(1).split(","))
379 results = [result] 383 results = [result]
380 elif match_list: 384 elif match_list:
381 results = map(str.strip, match_list.group(1).split(",")) 385 results = map(str.strip, match_list.group(1).split(","))
382 else: 386 else:
383 results = [body.strip()] 387 results = [body.strip()]
384 388
389 try:
390 results = map(lambda r: str(float(r)), results)
391 except ValueError:
392 results = []
393 errors = ["Found non-numeric in %s" %
394 "/".join(self.graphs + [graph, trace])]
395
385 trace_result = traces.setdefault(trace, Results([{ 396 trace_result = traces.setdefault(trace, Results([{
386 "graphs": self.graphs + [graph, trace], 397 "graphs": self.graphs + [graph, trace],
387 "units": (units or self.units).strip(), 398 "units": (units or self.units).strip(),
388 "results": [], 399 "results": [],
389 "stddev": "", 400 "stddev": "",
390 }], [])) 401 }], errors))
391 trace_result.traces[0]["results"].extend(results) 402 trace_result.traces[0]["results"].extend(results)
392 trace_result.traces[0]["stddev"] = stddev 403 trace_result.traces[0]["stddev"] = stddev
393 404
394 return reduce(lambda r, t: r + t, traces.itervalues(), Results()) 405 return reduce(lambda r, t: r + t, traces.itervalues(), Results())
395 406
396 407
397 def MakeGraph(suite, arch, parent): 408 def MakeGraph(suite, arch, parent):
398 """Factory method for making graph objects.""" 409 """Factory method for making graph objects."""
399 if isinstance(parent, Runnable): 410 if isinstance(parent, Runnable):
400 # Below a runnable can only be traces. 411 # Below a runnable can only be traces.
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 682
672 if options.json_test_results: 683 if options.json_test_results:
673 results.WriteToFile(options.json_test_results) 684 results.WriteToFile(options.json_test_results)
674 else: # pragma: no cover 685 else: # pragma: no cover
675 print results 686 print results
676 687
677 return min(1, len(results.errors)) 688 return min(1, len(results.errors))
678 689
679 if __name__ == "__main__": # pragma: no cover 690 if __name__ == "__main__": # pragma: no cover
680 sys.exit(Main(sys.argv[1:])) 691 sys.exit(Main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | tools/unittests/run_perf_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698