Python模块命令输出请求(在Linux上)
我需要知道以下PythonPython模块命令输出请求(在Linux上),python,module,output,Python,Module,Output,我需要知道以下Pythonpsutil模块命令输出对于多CPU(CPU插槽)计算机的作用: import psutil print(psutil.cpu_percent(interval=0.3, percpu=True)) print(psutil.sensors_temperatures(fahrenheit=False)) print(psutil.sensors_fans()) 注意:应安装Python软件包psutil。 注意2:最后两个命令在Windows上不可用。它们应该在Lin
psutil
模块命令输出对于多CPU(CPU插槽)计算机的作用:
import psutil
print(psutil.cpu_percent(interval=0.3, percpu=True))
print(psutil.sensors_temperatures(fahrenheit=False))
print(psutil.sensors_fans())
注意:应安装Python软件包psutil
。
注意2:最后两个命令在Windows上不可用。它们应该在Linux上运行。来自
- :1个或多个CPU返回相同的:1-d CPU百分比列表
返回percpu=False
如int
2.3
返回percpu=True
例如list[int]
{'acpitz' : [shwtemp(label='', current=47.0, high=103.0, critical=103.0)], 'asus' : [shwtemp(label='', current=47.0, high=None, critical=None)], 'coretemp': [shwtemp(label='Physical id 0', current=52.0, high=100.0, critical=100.0), shwtemp(label='Core 0', current=45.0, high=100.0, critical=100.0), shwtemp(label='Core 1', current=52.0, high=100.0, critical=100.0), shwtemp(label='Core 2', current=45.0, high=100.0, critical=100.0), shwtemp(label='Core 3', current=47.0, high=100.0, critical=100.0)]}
{'asus': [sfan(label='cpu_fan', current=3200)]}
- 对于1CPU-4芯-8螺纹
[23.8,5.0,10.0,5.0,15.0,5.0,15.0,23.8]
- 对于4CPU-4x4cores-4x8螺纹
[23.8、5.0、10.0、5.0、15.0、5.0、15.0、23.8、23.8、5.0、10.0、5.0、15.0、5.0、15.0、23.8、5.0、10.0、5.0、15.0、5.0、23.8、23.8、5.0、10.0、5.0、5.0、15.0、15.0、23.8]
- 对于1CPU-4芯-8螺纹
- 返回dict[str,list[namedtuple],例如
{'acpitz' : [shwtemp(label='', current=47.0, high=103.0, critical=103.0)], 'asus' : [shwtemp(label='', current=47.0, high=None, critical=None)], 'coretemp': [shwtemp(label='Physical id 0', current=52.0, high=100.0, critical=100.0), shwtemp(label='Core 0', current=45.0, high=100.0, critical=100.0), shwtemp(label='Core 1', current=52.0, high=100.0, critical=100.0), shwtemp(label='Core 2', current=45.0, high=100.0, critical=100.0), shwtemp(label='Core 3', current=47.0, high=100.0, critical=100.0)]}
{'asus': [sfan(label='cpu_fan', current=3200)]}
- 返回dict[str,list[namedtuple],例如
{'acpitz' : [shwtemp(label='', current=47.0, high=103.0, critical=103.0)], 'asus' : [shwtemp(label='', current=47.0, high=None, critical=None)], 'coretemp': [shwtemp(label='Physical id 0', current=52.0, high=100.0, critical=100.0), shwtemp(label='Core 0', current=45.0, high=100.0, critical=100.0), shwtemp(label='Core 1', current=52.0, high=100.0, critical=100.0), shwtemp(label='Core 2', current=45.0, high=100.0, critical=100.0), shwtemp(label='Core 3', current=47.0, high=100.0, critical=100.0)]}
{'asus': [sfan(label='cpu_fan', current=3200)]}