进程监控在python怎么实现?
提问人:杨紫红发布时间:2020-11-24
脚本如下:
#读取进程pid,名称,可执行路径
pid = psutil.pids()
for k,i in enumerate(pid):
try:
proc = psutil.Process(i)
print k,i,"%.2f%%"%(proc.memory_percent()),"%",proc.name(),proc.exe()
except psutil.AccessDenied :
print "psutil.AccessDenied"
#读取进程pid,名称,可执行路径
pid = psutil.pids()
for k,i in enumerate(pid):
try:
proc = psutil.Process(i)
print k,i,"%.2f%%"%(proc.memory_percent()),"%",proc.name(),proc.exe()
except psutil.AccessDenied :
print "psutil.AccessDenied"
继续查找其他问题的答案?
相关视频回答
回复(0)
点击加载更多评论>>