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

Side by Side Diff: tools/run_perf.py

Issue 953893002: Prepare v8 android perf runner for external startup data. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 | 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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 526
527 def PostExecution(self): 527 def PostExecution(self):
528 perf = perf_control.PerfControl(self.device) 528 perf = perf_control.PerfControl(self.device)
529 perf.SetDefaultPerfMode() 529 perf.SetDefaultPerfMode()
530 self.device.RunShellCommand(["rm", "-rf", AndroidPlatform.DEVICE_DIR]) 530 self.device.RunShellCommand(["rm", "-rf", AndroidPlatform.DEVICE_DIR])
531 531
532 def _SendCommand(self, cmd): 532 def _SendCommand(self, cmd):
533 logging.info("adb -s %s %s" % (str(self.device), cmd)) 533 logging.info("adb -s %s %s" % (str(self.device), cmd))
534 return self.adb.SendCommand(cmd, timeout_time=60) 534 return self.adb.SendCommand(cmd, timeout_time=60)
535 535
536 def _PushFile(self, host_dir, file_name, target_rel="."): 536 def _PushFile(self, host_dir, file_name, target_rel=".", only_existing=True):
vogelheim 2015/02/24 13:31:25 Maybe it's just me, but I was confused by the para
537 file_on_host = os.path.join(host_dir, file_name) 537 file_on_host = os.path.join(host_dir, file_name)
538 file_on_device_tmp = os.path.join( 538 file_on_device_tmp = os.path.join(
539 AndroidPlatform.DEVICE_DIR, "_tmp_", file_name) 539 AndroidPlatform.DEVICE_DIR, "_tmp_", file_name)
540 file_on_device = os.path.join( 540 file_on_device = os.path.join(
541 AndroidPlatform.DEVICE_DIR, target_rel, file_name) 541 AndroidPlatform.DEVICE_DIR, target_rel, file_name)
542 folder_on_device = os.path.dirname(file_on_device) 542 folder_on_device = os.path.dirname(file_on_device)
543 543
544 # Only attempt to push files that exist.
545 if not os.path.exists(file_on_host):
546 if only_existing:
547 logging.critical('Missing file on host: %s' % file_on_host)
548 return
549
544 # Only push files not yet pushed in one execution. 550 # Only push files not yet pushed in one execution.
545 if file_on_host in self.pushed: 551 if file_on_host in self.pushed:
546 return 552 return
547 else: 553 else:
548 self.pushed.add(file_on_host) 554 self.pushed.add(file_on_host)
549 555
550 # Work-around for "text file busy" errors. Push the files to a temporary 556 # Work-around for "text file busy" errors. Push the files to a temporary
551 # location and then copy them with a shell command. 557 # location and then copy them with a shell command.
552 output = self._SendCommand( 558 output = self._SendCommand(
553 "push %s %s" % (file_on_host, file_on_device_tmp)) 559 "push %s %s" % (file_on_host, file_on_device_tmp))
554 # Success looks like this: "3035 KB/s (12512056 bytes in 4.025s)". 560 # Success looks like this: "3035 KB/s (12512056 bytes in 4.025s)".
555 # Errors look like this: "failed to copy ... ". 561 # Errors look like this: "failed to copy ... ".
556 if output and not re.search('^[0-9]', output.splitlines()[-1]): 562 if output and not re.search('^[0-9]', output.splitlines()[-1]):
557 logging.critical('PUSH FAILED: ' + output) 563 logging.critical('PUSH FAILED: ' + output)
558 self._SendCommand("shell mkdir -p %s" % folder_on_device) 564 self._SendCommand("shell mkdir -p %s" % folder_on_device)
559 self._SendCommand("shell cp %s %s" % (file_on_device_tmp, file_on_device)) 565 self._SendCommand("shell cp %s %s" % (file_on_device_tmp, file_on_device))
560 566
561 def PreTests(self, node, path): 567 def PreTests(self, node, path):
562 suite_dir = os.path.abspath(os.path.dirname(path)) 568 suite_dir = os.path.abspath(os.path.dirname(path))
563 if node.path: 569 if node.path:
564 bench_rel = os.path.normpath(os.path.join(*node.path)) 570 bench_rel = os.path.normpath(os.path.join(*node.path))
565 bench_abs = os.path.join(suite_dir, bench_rel) 571 bench_abs = os.path.join(suite_dir, bench_rel)
566 else: 572 else:
567 bench_rel = "." 573 bench_rel = "."
568 bench_abs = suite_dir 574 bench_abs = suite_dir
569 575
570 self._PushFile(self.shell_dir, node.binary) 576 self._PushFile(self.shell_dir, node.binary)
577
578 # Push external startup data. Backwards compatible for revisions where
579 # these files didn't exist.
580 self._PushFile(self.shell_dir, "natives_blob.bin", only_existing=False)
581 self._PushFile(self.shell_dir, "snapshot_blob.bin", only_existing=False)
582
571 if isinstance(node, Runnable): 583 if isinstance(node, Runnable):
572 self._PushFile(bench_abs, node.main, bench_rel) 584 self._PushFile(bench_abs, node.main, bench_rel)
573 for resource in node.resources: 585 for resource in node.resources:
574 self._PushFile(bench_abs, resource, bench_rel) 586 self._PushFile(bench_abs, resource, bench_rel)
575 587
576 def Run(self, runnable, count): 588 def Run(self, runnable, count):
577 cache = cache_control.CacheControl(self.device) 589 cache = cache_control.CacheControl(self.device)
578 cache.DropRamCaches() 590 cache.DropRamCaches()
579 binary_on_device = AndroidPlatform.DEVICE_DIR + runnable.binary 591 binary_on_device = AndroidPlatform.DEVICE_DIR + runnable.binary
580 cmd = [binary_on_device] + runnable.GetCommandFlags() 592 cmd = [binary_on_device] + runnable.GetCommandFlags()
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 709
698 if options.json_test_results: 710 if options.json_test_results:
699 results.WriteToFile(options.json_test_results) 711 results.WriteToFile(options.json_test_results)
700 else: # pragma: no cover 712 else: # pragma: no cover
701 print results 713 print results
702 714
703 return min(1, len(results.errors)) 715 return min(1, len(results.errors))
704 716
705 if __name__ == "__main__": # pragma: no cover 717 if __name__ == "__main__": # pragma: no cover
706 sys.exit(Main(sys.argv[1:])) 718 sys.exit(Main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698