MCPcopy Index your code
hub / github.com/nodejs/node / GetCPUGovernor

Method GetCPUGovernor

deps/v8/tools/run_perf.py:1112–1129  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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):

Callers 2

__enter__Method · 0.80
SetCPUGovernorMethod · 0.80

Calls 4

GetCPUCoresRangeMethod · 0.80
GetCPUPathForIdMethod · 0.80
exceptionMethod · 0.80
openFunction · 0.50

Tested by

no test coverage detected