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

Side by Side Diff: tools/run_perf.py

Issue 779923002: Make JSTests ready for Android measurements. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 | « test/js-perf-test/JSTests.json ('k') | no next file » | 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 assert isinstance(suite["name"], basestring) 212 assert isinstance(suite["name"], basestring)
213 assert isinstance(suite.get("flags", []), list) 213 assert isinstance(suite.get("flags", []), list)
214 assert isinstance(suite.get("test_flags", []), list) 214 assert isinstance(suite.get("test_flags", []), list)
215 assert isinstance(suite.get("resources", []), list) 215 assert isinstance(suite.get("resources", []), list)
216 216
217 # Accumulated values. 217 # Accumulated values.
218 self.path = parent.path[:] + suite.get("path", []) 218 self.path = parent.path[:] + suite.get("path", [])
219 self.graphs = parent.graphs[:] + [suite["name"]] 219 self.graphs = parent.graphs[:] + [suite["name"]]
220 self.flags = parent.flags[:] + suite.get("flags", []) 220 self.flags = parent.flags[:] + suite.get("flags", [])
221 self.test_flags = parent.test_flags[:] + suite.get("test_flags", []) 221 self.test_flags = parent.test_flags[:] + suite.get("test_flags", [])
222 self.resources = parent.resources[:] + suite.get("resources", []) 222
223 # Values independent of parent node.
224 self.resources = suite.get("resources", [])
223 225
224 # Descrete values (with parent defaults). 226 # Descrete values (with parent defaults).
225 self.binary = suite.get("binary", parent.binary) 227 self.binary = suite.get("binary", parent.binary)
226 self.run_count = suite.get("run_count", parent.run_count) 228 self.run_count = suite.get("run_count", parent.run_count)
227 self.run_count = suite.get("run_count_%s" % arch, self.run_count) 229 self.run_count = suite.get("run_count_%s" % arch, self.run_count)
228 self.timeout = suite.get("timeout", parent.timeout) 230 self.timeout = suite.get("timeout", parent.timeout)
229 self.timeout = suite.get("timeout_%s" % arch, self.timeout) 231 self.timeout = suite.get("timeout_%s" % arch, self.timeout)
230 self.units = suite.get("units", parent.units) 232 self.units = suite.get("units", parent.units)
231 self.total = suite.get("total", parent.total) 233 self.total = suite.get("total", parent.total)
232 234
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 self.pushed = set() 514 self.pushed = set()
513 515
514 def PostExecution(self): 516 def PostExecution(self):
515 perf = perf_control.PerfControl(self.device) 517 perf = perf_control.PerfControl(self.device)
516 perf.SetDefaultPerfMode() 518 perf.SetDefaultPerfMode()
517 self.device.RunShellCommand( 519 self.device.RunShellCommand(
518 ["rm", "-rf", "*"], 520 ["rm", "-rf", "*"],
519 cwd=AndroidPlatform.DEVICE_DIR, 521 cwd=AndroidPlatform.DEVICE_DIR,
520 ) 522 )
521 523
522 def _PushFile(self, host_dir, file_name): 524 def _PushFile(self, host_dir, file_name, target_rel="."):
523 file_on_host = os.path.join(host_dir, file_name) 525 file_on_host = os.path.join(host_dir, file_name)
524 file_on_device = AndroidPlatform.DEVICE_DIR + file_name 526 file_on_device = os.path.join(
527 AndroidPlatform.DEVICE_DIR, target_rel, file_name)
525 528
526 # Only push files not yet pushed in one execution. 529 # Only push files not yet pushed in one execution.
527 if file_on_host in self.pushed: 530 if file_on_host in self.pushed:
528 return 531 return
529 else: 532 else:
530 self.pushed.add(file_on_host) 533 self.pushed.add(file_on_host)
531 534
532 logging.info("adb push %s %s" % (file_on_host, file_on_device)) 535 logging.info("adb push %s %s" % (file_on_host, file_on_device))
533 self.adb.Push(file_on_host, file_on_device) 536 self.adb.Push(file_on_host, file_on_device)
534 537
535 def PreTests(self, node, path): 538 def PreTests(self, node, path):
536 suite_dir = os.path.abspath(os.path.dirname(path)) 539 suite_dir = os.path.abspath(os.path.dirname(path))
537 if node.path: 540 if node.path:
538 bench_dir = os.path.join(suite_dir, 541 bench_rel = os.path.normpath(os.path.join(*node.path))
539 os.path.normpath(os.path.join(*node.path))) 542 bench_abs = os.path.join(suite_dir, bench_rel)
540 else: 543 else:
541 bench_dir = suite_dir 544 bench_rel = "."
545 bench_abs = suite_dir
542 546
543 self._PushFile(self.shell_dir, node.binary) 547 self._PushFile(self.shell_dir, node.binary)
544 if isinstance(node, Runnable): 548 if isinstance(node, Runnable):
545 self._PushFile(bench_dir, node.main) 549 self._PushFile(bench_abs, node.main, bench_rel)
546 for resource in node.resources: 550 for resource in node.resources:
547 self._PushFile(bench_dir, resource) 551 self._PushFile(bench_abs, resource, bench_rel)
548 552
549 def Run(self, runnable, count): 553 def Run(self, runnable, count):
550 cache = cache_control.CacheControl(self.device) 554 cache = cache_control.CacheControl(self.device)
551 cache.DropRamCaches() 555 cache.DropRamCaches()
552 binary_on_device = AndroidPlatform.DEVICE_DIR + runnable.binary 556 binary_on_device = AndroidPlatform.DEVICE_DIR + runnable.binary
553 cmd = [binary_on_device] + runnable.GetCommandFlags() 557 cmd = [binary_on_device] + runnable.GetCommandFlags()
558
559 # Relative path to benchmark directory.
560 if runnable.path:
561 bench_rel = os.path.normpath(os.path.join(*runnable.path))
562 else:
563 bench_rel = "."
564
554 try: 565 try:
555 output = self.device.RunShellCommand( 566 output = self.device.RunShellCommand(
556 cmd, 567 cmd,
557 cwd=AndroidPlatform.DEVICE_DIR, 568 cwd=os.path.join(AndroidPlatform.DEVICE_DIR, bench_rel),
558 timeout=runnable.timeout, 569 timeout=runnable.timeout,
559 retries=0, 570 retries=0,
560 ) 571 )
561 stdout = "\n".join(output) 572 stdout = "\n".join(output)
562 print ">>> Stdout (#%d):" % (count + 1) 573 print ">>> Stdout (#%d):" % (count + 1)
563 print stdout 574 print stdout
564 except device_errors.CommandTimeoutError: 575 except device_errors.CommandTimeoutError:
565 print ">>> Test timed out after %ss." % runnable.timeout 576 print ">>> Test timed out after %ss." % runnable.timeout
566 stdout = "" 577 stdout = ""
567 return stdout 578 return stdout
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 674
664 if options.json_test_results: 675 if options.json_test_results:
665 results.WriteToFile(options.json_test_results) 676 results.WriteToFile(options.json_test_results)
666 else: # pragma: no cover 677 else: # pragma: no cover
667 print results 678 print results
668 679
669 return min(1, len(results.errors)) 680 return min(1, len(results.errors))
670 681
671 if __name__ == "__main__": # pragma: no cover 682 if __name__ == "__main__": # pragma: no cover
672 sys.exit(Main(sys.argv[1:])) 683 sys.exit(Main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « test/js-perf-test/JSTests.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698