psutil
provides a cross-platform solution to get resource usage of a subprocess e.g.:
import random
import psutil # $ pip install psutil
p = psutil.Process(random.choice(psutil.pids()))
print(p.name())
print(p.cpu_times())
print(p.memory_info())
to get the info for an existing subprocess.Popen
instance just pass popen_instance.pid
to psutil.Process
. You could also create a subprocess using psutil.Popen
directly.