進程監(jiān)控在python怎么實現(xiàn)?
提問人:楊紫紅發(fā)布時間:2020-11-24
腳本如下:
#讀取進程pid,名稱,可執(zhí)行路徑
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,名稱,可執(zhí)行路徑
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"
繼續(xù)查找其他問題的答案?
相關視頻回答
點擊加載更多評論>>