目前,我使用psutil
获取RAM百分比
print (' ')
print ('----------------------CPU Information summary----------------------')
print (' ')
# gives a single float value
vcc=psutil.cpu_count()
print ('Total number of CPUs :',vcc)
vcpu=psutil.cpu_percent()
print ('Total CPUs utilized percentage :',vcpu,'%')
但是当我运行代码时,我得到了这个
----------------------CPU Information summary----------------------
Total number of CPUs : 8
Total CPUs utilized percentage : 0.0 %
但我希望它在任务管理器中打印CPU%
如文件所述:
psutil.cpu\u百分比(间隔=无,percpu=假)
因此,它需要在调用之间有一个间隔,这样它才能给出正确的百分比
这样调用它(或者尝试使用interval参数):
相关问题 更多 >
编程相关推荐