OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
6 | 6 |
7 # Simple wrapper for running benchmarks. | 7 # Simple wrapper for running benchmarks. |
8 | 8 |
9 import getopt | 9 import getopt |
10 import optparse | 10 import optparse |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 metavar='[all,debug,release]', | 47 metavar='[all,debug,release]', |
48 default='release') | 48 default='release') |
49 result.add_option("-v", "--verbose", | 49 result.add_option("-v", "--verbose", |
50 help='Verbose output.', | 50 help='Verbose output.', |
51 default=False, action="store_true") | 51 default=False, action="store_true") |
52 result.add_option("-c", "--core", | 52 result.add_option("-c", "--core", |
53 help='Run only core benchmarks.', | 53 help='Run only core benchmarks.', |
54 default=False, action="store_true") | 54 default=False, action="store_true") |
55 result.add_option("--arch", | 55 result.add_option("--arch", |
56 help='Target architectures (comma-separated).', | 56 help='Target architectures (comma-separated).', |
57 metavar='[all,ia32,x64,simarm,arm,dartc]', | 57 metavar='[all,ia32,x64,simarm,simmips,arm,mips,dartc]', |
58 default=utils.GuessArchitecture()) | 58 default=utils.GuessArchitecture()) |
59 result.add_option("--executable", | 59 result.add_option("--executable", |
60 help='Virtual machine to execute.', | 60 help='Virtual machine to execute.', |
61 metavar='[dart, (path to dart binary)]', | 61 metavar='[dart, (path to dart binary)]', |
62 default=None) | 62 default=None) |
63 result.add_option("-w", "--warmup", | 63 result.add_option("-w", "--warmup", |
64 help='Only run the warmup period.', | 64 help='Only run the warmup period.', |
65 default=False, action="store_true") | 65 default=False, action="store_true") |
66 return result | 66 return result |
67 | 67 |
68 | 68 |
69 def ProcessOptions(options): | 69 def ProcessOptions(options): |
70 if options.arch == 'all': | 70 if options.arch == 'all': |
71 options.arch = 'ia32,x64,simarm,dartc' | 71 options.arch = 'ia32,x64,simarm,simmips,dartc' |
72 if options.mode == 'all': | 72 if options.mode == 'all': |
73 options.mode = 'debug,release' | 73 options.mode = 'debug,release' |
74 options.mode = options.mode.split(',') | 74 options.mode = options.mode.split(',') |
75 options.arch = options.arch.split(',') | 75 options.arch = options.arch.split(',') |
76 for mode in options.mode: | 76 for mode in options.mode: |
77 if not mode in ['debug', 'release']: | 77 if not mode in ['debug', 'release']: |
78 print "Unknown mode %s" % mode | 78 print "Unknown mode %s" % mode |
79 return False | 79 return False |
80 for arch in options.arch: | 80 for arch in options.arch: |
81 if not arch in ['ia32', 'x64', 'simarm', 'arm', 'dartc']: | 81 if not arch in ['ia32', 'x64', 'simarm', 'simmips', 'arm', 'mips', 'dartc']: |
82 print "Unknown arch %s" % arch | 82 print "Unknown arch %s" % arch |
83 return False | 83 return False |
84 return True | 84 return True |
85 | 85 |
86 | 86 |
87 def GetBuildRoot(mode, arch): | 87 def GetBuildRoot(mode, arch): |
88 return utils.GetBuildRoot(HOST_OS, mode, arch) | 88 return utils.GetBuildRoot(HOST_OS, mode, arch) |
89 | 89 |
90 def GetDart(mode, arch): | 90 def GetDart(mode, arch): |
91 executable = [abspath(join(GetBuildRoot(mode, arch), 'dart'))] | 91 executable = [abspath(join(GetBuildRoot(mode, arch), 'dart'))] |
(...skipping 29 matching lines...) Expand all Loading... |
121 GetBenchmarkFile([benchmark, 'dart', benchmark + '.dart']), | 121 GetBenchmarkFile([benchmark, 'dart', benchmark + '.dart']), |
122 ] | 122 ] |
123 if options.verbose: | 123 if options.verbose: |
124 print ' '.join(command) | 124 print ' '.join(command) |
125 subprocess.call(command) | 125 subprocess.call(command) |
126 return 0 | 126 return 0 |
127 | 127 |
128 | 128 |
129 if __name__ == '__main__': | 129 if __name__ == '__main__': |
130 sys.exit(Main()) | 130 sys.exit(Main()) |
OLD | NEW |