我需要一些关于终止后一个子进程的信息。
像这样utime和VMPeak像/proc这样:
proc.wait()
with open('/proc/%d/stat' % proc.pid, "r") as f:
stat = str(f.read()).strip().split()
# 14th column is utime, 15th column is stime (man 5 proc)
cpu_time = int(stat[14]) + int(stat[15])
return cpu_time
但是 PythonPopen.wait()发布了PID,所以我会得到:
No such file or directory
我可以在终止后得到它,还是等待终止而不释放PID?(我的意思是等待终止而不调用wait(),这将释放所有资源。)
如果你能帮助我,我将不胜感激。谢谢!