mirror of
https://github.com/erpalma/throttled.git
synced 2026-03-10 06:53:54 +01:00
Merge pull request #372 from sandy-8925/disabled_cpu_fix
Only attempt changing currently enabled CPUs
This commit is contained in:
commit
26021c8cd3
|
|
@ -222,8 +222,11 @@ def warning(msg, oneshot=True, end='\n'):
|
|||
log_history.add(msg.strip())
|
||||
|
||||
|
||||
def get_msr_list():
|
||||
return ['/dev/cpu/{:d}/msr'.format(int(x)) for x in os.listdir("/dev/cpu")]
|
||||
|
||||
def writemsr(msr, val):
|
||||
msr_list = ['/dev/cpu/{:d}/msr'.format(x) for x in range(cpu_count())]
|
||||
msr_list = get_msr_list()
|
||||
if not os.path.exists(msr_list[0]):
|
||||
try:
|
||||
subprocess.check_call(('modprobe', 'msr'))
|
||||
|
|
@ -254,7 +257,7 @@ def readmsr(msr, from_bit=0, to_bit=63, cpu=None, flatten=False):
|
|||
assert cpu is None or cpu in range(cpu_count())
|
||||
if from_bit > to_bit:
|
||||
fatal('Wrong readmsr bit params')
|
||||
msr_list = ['/dev/cpu/{:d}/msr'.format(x) for x in range(cpu_count())]
|
||||
msr_list = get_msr_list()
|
||||
if not os.path.exists(msr_list[0]):
|
||||
try:
|
||||
subprocess.check_call(('modprobe', 'msr'))
|
||||
|
|
|
|||
Loading…
Reference in a new issue