获取cpu、内存利用率
# -*- coding: latin1 -*-
import psutil
cpuPercent =0
psutil.cpu_percent()
while True:
vm = psutil.virtual_memory()
memoryPercent = vm.percent
cpuPercent = psutil.cpu_percent(1) *10
print("cpuPercent:"+str(cpuPercent)+" %")
print("memory:"+str(memoryPercent)+" %")
input("any key")