python监控本机cpu的利用百分比情况

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

python监控本机cpu的利用百分比情况
import wmi
import time
 
c = wmi.WMI()
while True:
    for cpu in c.Win32_Processor():
        timestamp = time.strftime('%a, %d %b %Y %H:%M:%S', time.localtime())
        print '%s | Utilization: %s: %d %%' % (timestamp, cpu.DeviceID, cpu.LoadPercentage)
        time.sleep(5)