| 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 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 | 849 |
| 850 new_value = CustomMachineConfiguration.GetASLR() | 850 new_value = CustomMachineConfiguration.GetASLR() |
| 851 if value != new_value: | 851 if value != new_value: |
| 852 raise Exception("Present value is %s" % new_value) | 852 raise Exception("Present value is %s" % new_value) |
| 853 | 853 |
| 854 @staticmethod | 854 @staticmethod |
| 855 def GetCPUCoresRange(): | 855 def GetCPUCoresRange(): |
| 856 try: | 856 try: |
| 857 with open("/sys/devices/system/cpu/present", "r") as f: | 857 with open("/sys/devices/system/cpu/present", "r") as f: |
| 858 indexes = f.readline() | 858 indexes = f.readline() |
| 859 first, last = map(int, indexes.split("-")) | 859 r = map(int, indexes.split("-")) |
| 860 return range(first, last + 1) | 860 if len(r) == 1: |
| 861 return range(r[0], r[0] + 1) |
| 862 return range(r[0], r[1] + 1) |
| 861 except Exception as e: | 863 except Exception as e: |
| 862 print "Failed to retrieve number of CPUs." | 864 print "Failed to retrieve number of CPUs." |
| 863 raise e | 865 raise e |
| 864 | 866 |
| 865 @staticmethod | 867 @staticmethod |
| 866 def GetCPUPathForId(cpu_index): | 868 def GetCPUPathForId(cpu_index): |
| 867 ret = "/sys/devices/system/cpu/cpu" | 869 ret = "/sys/devices/system/cpu/cpu" |
| 868 ret += str(cpu_index) | 870 ret += str(cpu_index) |
| 869 ret += "/cpufreq/scaling_governor" | 871 ret += "/cpufreq/scaling_governor" |
| 870 return ret | 872 return ret |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 | 1071 |
| 1070 if options.json_test_results_no_patch: | 1072 if options.json_test_results_no_patch: |
| 1071 results_no_patch.WriteToFile(options.json_test_results_no_patch) | 1073 results_no_patch.WriteToFile(options.json_test_results_no_patch) |
| 1072 else: # pragma: no cover | 1074 else: # pragma: no cover |
| 1073 print results_no_patch | 1075 print results_no_patch |
| 1074 | 1076 |
| 1075 return min(1, len(results.errors)) | 1077 return min(1, len(results.errors)) |
| 1076 | 1078 |
| 1077 if __name__ == "__main__": # pragma: no cover | 1079 if __name__ == "__main__": # pragma: no cover |
| 1078 sys.exit(Main(sys.argv[1:])) | 1080 sys.exit(Main(sys.argv[1:])) |
| OLD | NEW |