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

Side by Side Diff: tools/run_perf.py

Issue 815003003: Work-around for file pushing in android perf runner. (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 | 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 perf.SetHighPerfMode() 522 perf.SetHighPerfMode()
523 523
524 # Remember what we have already pushed to the device. 524 # Remember what we have already pushed to the device.
525 self.pushed = set() 525 self.pushed = set()
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):
533 logging.info("adb -s %s %s" % (str(self.device), cmd))
534 return self.adb.SendCommand(cmd, timeout_time=60)
535
532 def _PushFile(self, host_dir, file_name, target_rel="."): 536 def _PushFile(self, host_dir, file_name, target_rel="."):
533 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(
539 AndroidPlatform.DEVICE_DIR, "_tmp_", file_name)
534 file_on_device = os.path.join( 540 file_on_device = os.path.join(
535 AndroidPlatform.DEVICE_DIR, target_rel, file_name) 541 AndroidPlatform.DEVICE_DIR, target_rel, file_name)
536 542
537 # Only push files not yet pushed in one execution. 543 # Only push files not yet pushed in one execution.
538 if file_on_host in self.pushed: 544 if file_on_host in self.pushed:
539 return 545 return
540 else: 546 else:
541 self.pushed.add(file_on_host) 547 self.pushed.add(file_on_host)
542 548
543 logging.info("adb push %s %s" % (file_on_host, file_on_device)) 549 # Work-around for "text file busy" errors. Push the files to a temporary
544 self.adb.Push(file_on_host, file_on_device) 550 # location and then move them with a shell command.
551 output = self._SendCommand(
552 "push %s %s" % (file_on_host, file_on_device_tmp))
553 # Success looks like this: "3035 KB/s (12512056 bytes in 4.025s)".
554 # Errors look like this: "failed to copy ... ".
555 if output and not re.search('^[0-9]', output.splitlines()[-1]):
556 logging.critical('PUSH FAILED: ' + output)
557 self._SendCommand("shell mv %s %s" % (file_on_device_tmp, file_on_device))
545 558
546 def PreTests(self, node, path): 559 def PreTests(self, node, path):
547 suite_dir = os.path.abspath(os.path.dirname(path)) 560 suite_dir = os.path.abspath(os.path.dirname(path))
548 if node.path: 561 if node.path:
549 bench_rel = os.path.normpath(os.path.join(*node.path)) 562 bench_rel = os.path.normpath(os.path.join(*node.path))
550 bench_abs = os.path.join(suite_dir, bench_rel) 563 bench_abs = os.path.join(suite_dir, bench_rel)
551 else: 564 else:
552 bench_rel = "." 565 bench_rel = "."
553 bench_abs = suite_dir 566 bench_abs = suite_dir
554 567
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 695
683 if options.json_test_results: 696 if options.json_test_results:
684 results.WriteToFile(options.json_test_results) 697 results.WriteToFile(options.json_test_results)
685 else: # pragma: no cover 698 else: # pragma: no cover
686 print results 699 print results
687 700
688 return min(1, len(results.errors)) 701 return min(1, len(results.errors))
689 702
690 if __name__ == "__main__": # pragma: no cover 703 if __name__ == "__main__": # pragma: no cover
691 sys.exit(Main(sys.argv[1:])) 704 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