查看内存信息
psutil.virtual_memory()
svmem(total=1019797504, available=792227840, percent=22.3, used=894402560, free=125394944, active=368201728, inactive=343019520, buffers=167936, cached=666664960)
total 整个内存大小
available 可用内存大小
percent 已经使用的内存大小
转换
792018944/1024/1024=755M
792018944/1024/1024/1024=0.737G
查看虚拟内存信息
psutil.swap_memory()
sswap(total=2147479552, used=270336, free=2147209216, percent=0.0, sin=0, sout=16384)
total 整个虚拟内存大小
used 使用了的虚拟内存
free 空闲的虚拟内存
percent已经使用的虚拟内存大小
查看cpu所有信息
psutil.cpu_times()
scputimes(user=127.95, nice=0.14, system=82.51, idle=59372.49, iowait=2.32, irq=0.0, softirq=7.84, steal=0.0, guest=0.0, guest_nice=0.0)
user执行用户进程的时间百分比
system执行内核进程和中断的时间百分比
iowait由于IO等待而使CPU处于idle(空闲)状态的时间百分比
Idle,CPU处于id