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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
404 trace_result.traces[0]["stddev"] = stddev | 404 trace_result.traces[0]["stddev"] = stddev |
405 | 405 |
406 return reduce(lambda r, t: r + t, traces.itervalues(), Results()) | 406 return reduce(lambda r, t: r + t, traces.itervalues(), Results()) |
407 | 407 |
408 | 408 |
409 def MakeGraph(suite, arch, parent): | 409 def MakeGraph(suite, arch, parent): |
410 """Factory method for making graph objects.""" | 410 """Factory method for making graph objects.""" |
411 if isinstance(parent, Runnable): | 411 if isinstance(parent, Runnable): |
412 # Below a runnable can only be traces. | 412 # Below a runnable can only be traces. |
413 return Trace(suite, parent, arch) | 413 return Trace(suite, parent, arch) |
414 elif suite.get("main"): | 414 elif suite.get("main") != None: |
Michael Achenbach
2015/04/10 09:09:47
is not None
| |
415 # A main file makes this graph runnable. | 415 # A main file makes this graph runnable. Empty strings are accepted. |
416 if suite.get("tests"): | 416 if suite.get("tests"): |
417 # This graph has subgraphs (traces). | 417 # This graph has subgraphs (traces). |
418 return Runnable(suite, parent, arch) | 418 return Runnable(suite, parent, arch) |
419 else: | 419 else: |
420 # This graph has no subgraphs, it's a leaf. | 420 # This graph has no subgraphs, it's a leaf. |
421 return RunnableTrace(suite, parent, arch) | 421 return RunnableTrace(suite, parent, arch) |
422 elif suite.get("generic"): | 422 elif suite.get("generic"): |
423 # This is a generic suite definition. It is either a runnable executable | 423 # This is a generic suite definition. It is either a runnable executable |
424 # or has a main js file. | 424 # or has a main js file. |
425 return RunnableGeneric(suite, parent, arch) | 425 return RunnableGeneric(suite, parent, arch) |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
711 | 711 |
712 if options.json_test_results: | 712 if options.json_test_results: |
713 results.WriteToFile(options.json_test_results) | 713 results.WriteToFile(options.json_test_results) |
714 else: # pragma: no cover | 714 else: # pragma: no cover |
715 print results | 715 print results |
716 | 716 |
717 return min(1, len(results.errors)) | 717 return min(1, len(results.errors)) |
718 | 718 |
719 if __name__ == "__main__": # pragma: no cover | 719 if __name__ == "__main__": # pragma: no cover |
720 sys.exit(Main(sys.argv[1:])) | 720 sys.exit(Main(sys.argv[1:])) |
OLD | NEW |