implement psutil recursion manually