cpu几核

import psutil


def GetCpuInfo():
cpu_count = psutil.cpu_count(logical=False) #1代表单核CPU,2代表双核CPU
xc_count = psutil.cpu_count() #线程数,如双核四线程
cpu_slv = round((psutil.cpu_percent(1)), 2) # cpu使用率
list = [cpu_count,xc_count,cpu_slv]
return list
print(GetCpuInfo())
posted @ 2020-01-31 21:30  知一以天  阅读(227)  评论(0编辑  收藏  举报