OLD | NEW |
---|---|
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 The test flags are passed to the js test file after '--'. | 95 The test flags are passed to the js test file after '--'. |
96 """ | 96 """ |
97 | 97 |
98 from collections import OrderedDict | 98 from collections import OrderedDict |
99 import json | 99 import json |
100 import logging | 100 import logging |
101 import math | 101 import math |
102 import optparse | 102 import optparse |
103 import os | 103 import os |
104 import re | 104 import re |
105 import subprocess | |
105 import sys | 106 import sys |
106 | 107 |
107 from testrunner.local import commands | 108 from testrunner.local import commands |
108 from testrunner.local import utils | 109 from testrunner.local import utils |
109 | 110 |
110 ARCH_GUESS = utils.DefaultArch() | 111 ARCH_GUESS = utils.DefaultArch() |
111 SUPPORTED_ARCHS = ["arm", | 112 SUPPORTED_ARCHS = ["arm", |
112 "ia32", | 113 "ia32", |
113 "mips", | 114 "mips", |
114 "mipsel", | 115 "mipsel", |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
450 suite_dir = os.path.abspath(os.path.dirname(suite_path)) | 451 suite_dir = os.path.abspath(os.path.dirname(suite_path)) |
451 bench_dir = os.path.normpath(os.path.join(*self.path)) | 452 bench_dir = os.path.normpath(os.path.join(*self.path)) |
452 os.chdir(os.path.join(suite_dir, bench_dir)) | 453 os.chdir(os.path.join(suite_dir, bench_dir)) |
453 | 454 |
454 def GetCommandFlags(self, extra_flags=None): | 455 def GetCommandFlags(self, extra_flags=None): |
455 suffix = ["--"] + self.test_flags if self.test_flags else [] | 456 suffix = ["--"] + self.test_flags if self.test_flags else [] |
456 return self.flags + (extra_flags or []) + [self.main] + suffix | 457 return self.flags + (extra_flags or []) + [self.main] + suffix |
457 | 458 |
458 def GetCommand(self, shell_dir, extra_flags=None): | 459 def GetCommand(self, shell_dir, extra_flags=None): |
459 # TODO(machenbach): This requires +.exe if run on windows. | 460 # TODO(machenbach): This requires +.exe if run on windows. |
461 extra_flags = extra_flags or [] | |
460 cmd = [os.path.join(shell_dir, self.binary)] | 462 cmd = [os.path.join(shell_dir, self.binary)] |
463 if self.binary != 'd8' and '--prof' in self.extra_flags: | |
Michael Achenbach
2015/09/15 07:03:40
Ah crap - didn't catch this. s/self.extra_flags/ex
| |
464 print "Profiler supported only on a benchmark run with d8" | |
461 return cmd + self.GetCommandFlags(extra_flags=extra_flags) | 465 return cmd + self.GetCommandFlags(extra_flags=extra_flags) |
462 | 466 |
463 def Run(self, runner, trybot): | 467 def Run(self, runner, trybot): |
464 """Iterates over several runs and handles the output for all traces.""" | 468 """Iterates over several runs and handles the output for all traces.""" |
465 stdout_with_patch, stdout_no_patch = Unzip(runner()) | 469 stdout_with_patch, stdout_no_patch = Unzip(runner()) |
466 return ( | 470 return ( |
467 AccumulateResults( | 471 AccumulateResults( |
468 self.graphs, | 472 self.graphs, |
469 self._children, | 473 self._children, |
470 iter_output=stdout_with_patch, | 474 iter_output=stdout_with_patch, |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
633 print e | 637 print e |
634 return "" | 638 return "" |
635 print title % "Stdout" | 639 print title % "Stdout" |
636 print output.stdout | 640 print output.stdout |
637 if output.stderr: # pragma: no cover | 641 if output.stderr: # pragma: no cover |
638 # Print stderr for debugging. | 642 # Print stderr for debugging. |
639 print title % "Stderr" | 643 print title % "Stderr" |
640 print output.stderr | 644 print output.stderr |
641 if output.timed_out: | 645 if output.timed_out: |
642 print ">>> Test timed out after %ss." % runnable.timeout | 646 print ">>> Test timed out after %ss." % runnable.timeout |
647 if '--prof' in self.extra_flags: | |
648 if utils.GuessOS() == "linux": | |
649 tick_tools = os.path.abspath(os.path.join(shell_dir, "..", "..", | |
650 "tools", | |
651 "linux-tick-processor")) | |
652 elif utils.GuessOS() == "macos": | |
653 tick_tools = os.path.abspath(os.path.join(shell_dir, "..", "..", | |
654 "tools", | |
655 "mac-tick-processor")) | |
656 else: | |
657 print "Profiler option currently supported on Linux and Mac OS." | |
658 prof_cmd = tick_tools + " --only-summary" | |
Michael Achenbach
2015/09/15 07:03:40
In the else case, tick_tools is read before assign
| |
659 subprocess.check_call(prof_cmd, shell=True) | |
643 return output.stdout | 660 return output.stdout |
644 | 661 |
645 | 662 |
646 class AndroidPlatform(Platform): # pragma: no cover | 663 class AndroidPlatform(Platform): # pragma: no cover |
647 DEVICE_DIR = "/data/local/tmp/v8/" | 664 DEVICE_DIR = "/data/local/tmp/v8/" |
648 | 665 |
649 def __init__(self, options): | 666 def __init__(self, options): |
650 super(AndroidPlatform, self).__init__(options) | 667 super(AndroidPlatform, self).__init__(options) |
651 LoadAndroidBuildTools(options.android_build_tools) | 668 LoadAndroidBuildTools(options.android_build_tools) |
652 | 669 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
891 | 908 |
892 if options.json_test_results_no_patch: | 909 if options.json_test_results_no_patch: |
893 results_no_patch.WriteToFile(options.json_test_results_no_patch) | 910 results_no_patch.WriteToFile(options.json_test_results_no_patch) |
894 else: # pragma: no cover | 911 else: # pragma: no cover |
895 print results_no_patch | 912 print results_no_patch |
896 | 913 |
897 return min(1, len(results.errors)) | 914 return min(1, len(results.errors)) |
898 | 915 |
899 if __name__ == "__main__": # pragma: no cover | 916 if __name__ == "__main__": # pragma: no cover |
900 sys.exit(Main(sys.argv[1:])) | 917 sys.exit(Main(sys.argv[1:])) |
OLD | NEW |