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

Method SetCPUGovernor

deps/v8/tools/run_perf.py:1132–1148  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

1130
1131 @staticmethod
1132 def SetCPUGovernor(value):
1133 try:
1134 cpu_indices = CustomMachineConfiguration.GetCPUCoresRange()
1135 for cpu_index in cpu_indices:
1136 cpu_device = CustomMachineConfiguration.GetCPUPathForId(cpu_index)
1137 with open(cpu_device, 'w') as f:
1138 f.write(value)
1139
1140 except Exception:
1141 logging.exception('Failed to change CPU governor to %s. Are we '
1142 'running under sudo?', value)
1143 raise
1144
1145 cur_value = CustomMachineConfiguration.GetCPUGovernor()
1146 if cur_value != value:
1147 raise Exception('Could not set CPU governor. Present value is %s'
1148 % cur_value )
1149
1150
1151class MaxTotalDurationReachedError(Exception):

Callers 2

__enter__Method · 0.80
__exit__Method · 0.80

Calls 6

GetCPUCoresRangeMethod · 0.80
GetCPUPathForIdMethod · 0.80
exceptionMethod · 0.80
GetCPUGovernorMethod · 0.80
openFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected