-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathexample.py
47 lines (37 loc) · 918 Bytes
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from cpufreq import cpuFreq
from collections import Counter
import time
cpu= cpuFreq()
cpu.reset()
cpu.disable_hyperthread()
freqs= cpu.get_frequencies()
print(freqs)
govs= cpu.get_governors()
print(govs)
online_cpus= cpu.get_online_cpus()
print(online_cpus)
available_govs= cpu.available_governors
print(available_govs)
cpu.set_governors("powersave")
govs= cpu.get_governors()
print(govs)
cpu.set_governors("performance")
govs= cpu.get_governors()
print(govs)
cpu.set_governors("userspace")
govs= cpu.get_governors()
print(govs)
available_freqs= cpu.available_frequencies
for f in available_freqs[1:]:
cpu.set_frequencies(f)
mfreq= []
for _ in range(10):
freqs= cpu.get_frequencies()
mfreq.append(Counter(freqs))
time.sleep(0.1)
print(sum(mfreq,Counter()))
cpu.disable_cpu(2)
print(cpu.get_online_cpus())
cpu.enable_cpu(2)
print(cpu.get_online_cpus())
cpu.reset()