()
| 1110 | |
| 1111 | @staticmethod |
| 1112 | def GetCPUGovernor(): |
| 1113 | try: |
| 1114 | cpu_indices = CustomMachineConfiguration.GetCPUCoresRange() |
| 1115 | ret = None |
| 1116 | for cpu_index in cpu_indices: |
| 1117 | cpu_device = CustomMachineConfiguration.GetCPUPathForId(cpu_index) |
| 1118 | with open(cpu_device, 'r') as f: |
| 1119 | # We assume the governors of all CPUs are set to the same value |
| 1120 | val = f.readline().strip() |
| 1121 | if ret is None: |
| 1122 | ret = val |
| 1123 | elif ret != val: |
| 1124 | raise Exception('CPU cores have differing governor settings') |
| 1125 | return ret |
| 1126 | except Exception: |
| 1127 | logging.exception('Failed to get the current CPU governor. Is the CPU ' |
| 1128 | 'governor disabled? Check BIOS.') |
| 1129 | raise |
| 1130 | |
| 1131 | @staticmethod |
| 1132 | def SetCPUGovernor(value): |
no test coverage detected