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 |
11 The suite json format is expected to be: | 11 The suite json format is expected to be: |
12 { | 12 { |
13 "path": <relative path chunks to perf resources and main file>, | 13 "path": <relative path chunks to perf resources and main file>, |
14 "name": <optional suite name, file name is default>, | 14 "name": <optional suite name, file name is default>, |
15 "archs": [<architecture name for which this suite is run>, ...], | 15 "archs": [<architecture name for which this suite is run>, ...], |
16 "binary": <name of binary to run, default "d8">, | 16 "binary": <name of binary to run, default "d8">, |
17 "flags": [<flag to d8>, ...], | 17 "flags": [<flag to d8>, ...], |
18 "test_flags": [<flag to the test file>, ...], | 18 "test_flags": [<flag to the test file>, ...], |
19 "run_count": <how often will this suite run (optional)>, | 19 "run_count": <how often will this suite run (optional)>, |
20 "run_count_XXX": <how often will this suite run for arch XXX (optional)>, | 20 "run_count_XXX": <how often will this suite run for arch XXX (optional)>, |
21 "resources": [<js file to be loaded before main>, ...] | 21 "resources": [<js file to be moved to android device>, ...] |
22 "main": <main js perf runner file>, | 22 "main": <main js perf runner file>, |
23 "results_regexp": <optional regexp>, | 23 "results_regexp": <optional regexp>, |
24 "results_processor": <optional python results processor script>, | 24 "results_processor": <optional python results processor script>, |
25 "units": <the unit specification for the performance dashboard>, | 25 "units": <the unit specification for the performance dashboard>, |
26 "tests": [ | 26 "tests": [ |
27 { | 27 { |
28 "name": <name of the trace>, | 28 "name": <name of the trace>, |
29 "results_regexp": <optional more specific regexp>, | 29 "results_regexp": <optional more specific regexp>, |
30 "results_processor": <optional python results processor script>, | 30 "results_processor": <optional python results processor script>, |
31 "units": <the unit specification for the performance dashboard>, | 31 "units": <the unit specification for the performance dashboard>, |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 suite_dir = os.path.abspath(os.path.dirname(suite_path)) | 286 suite_dir = os.path.abspath(os.path.dirname(suite_path)) |
287 bench_dir = os.path.normpath(os.path.join(*self.path)) | 287 bench_dir = os.path.normpath(os.path.join(*self.path)) |
288 os.chdir(os.path.join(suite_dir, bench_dir)) | 288 os.chdir(os.path.join(suite_dir, bench_dir)) |
289 | 289 |
290 def GetCommand(self, shell_dir): | 290 def GetCommand(self, shell_dir): |
291 # TODO(machenbach): This requires +.exe if run on windows. | 291 # TODO(machenbach): This requires +.exe if run on windows. |
292 suffix = ["--"] + self.test_flags if self.test_flags else [] | 292 suffix = ["--"] + self.test_flags if self.test_flags else [] |
293 return ( | 293 return ( |
294 [os.path.join(shell_dir, self.binary)] + | 294 [os.path.join(shell_dir, self.binary)] + |
295 self.flags + | 295 self.flags + |
296 self.resources + | |
297 [self.main] + | 296 [self.main] + |
298 suffix | 297 suffix |
299 ) | 298 ) |
300 | 299 |
301 def Run(self, runner): | 300 def Run(self, runner): |
302 """Iterates over several runs and handles the output for all traces.""" | 301 """Iterates over several runs and handles the output for all traces.""" |
303 for stdout in runner(): | 302 for stdout in runner(): |
304 for trace in self._children: | 303 for trace in self._children: |
305 trace.ConsumeOutput(stdout) | 304 trace.ConsumeOutput(stdout) |
306 res = reduce(lambda r, t: r + t.GetResults(), self._children, Results()) | 305 res = reduce(lambda r, t: r + t.GetResults(), self._children, Results()) |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 | 507 |
509 if options.json_test_results: | 508 if options.json_test_results: |
510 results.WriteToFile(options.json_test_results) | 509 results.WriteToFile(options.json_test_results) |
511 else: # pragma: no cover | 510 else: # pragma: no cover |
512 print results | 511 print results |
513 | 512 |
514 return min(1, len(results.errors)) | 513 return min(1, len(results.errors)) |
515 | 514 |
516 if __name__ == "__main__": # pragma: no cover | 515 if __name__ == "__main__": # pragma: no cover |
517 sys.exit(Main(sys.argv[1:])) | 516 sys.exit(Main(sys.argv[1:])) |
OLD | NEW |