Skip to content

Commit

Permalink
初始化获取cpu_topology,避免重复获取
Browse files Browse the repository at this point in the history
  • Loading branch information
honjow committed Nov 23, 2023
1 parent 6186769 commit 88cbd7b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions backend/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
cpu_nowLimitFreq=0

class CPU_Manager ():
def __init__(self):
self.get_cpuMaxNum() # 获取 cpu_maxNum
# 获取 cpu_topology
self.set_enable_All() # 先开启所有cpu, 否则拓扑信息不全
self.cpu_topology = self.get_cpu_topology()

cpu_topology = {}

def get_hasRyzenadj(self):
try:
Expand Down Expand Up @@ -130,9 +137,7 @@ def set_cpuOnline(self, value: int):
global cpu_num
cpu_num=value

# 获取当前cpu拓扑
self.set_enable_All() # 先开启所有cpu, 否则拓扑信息不全
cpu_topology = self.get_cpu_topology()
cpu_topology = self.cpu_topology
enabled_cores = list(set(int(core) for core in cpu_topology.values()))

# 初始化关闭 Set
Expand Down

0 comments on commit 88cbd7b

Please sign in to comment.