Put the logic to generate PG process tree PID list into a function of its own.

We can now use this function to feed the PID list to external tools, like top.