Refactor the existing code so it can be used in more locations.
HPCC-18834 Process memory and CPU stats improvements