From the command line, how would I get the total physical and virtual memory usage of a process and all of its descendants (not just 1st-level children)?
This is useful when you want to monitor the memory usage of applications that are not monolithic. For instance, Google Chrome spawns a whole bunch of workers and renderers, even though to the user, it's all in only one GUI window. Another example is Firefox, which has separate processes for its plugins.
The Activity Monitor application can display the processes in a hierarchy. But I find it not good enough, for two reasons:
- It's not command-line;
- It doesn't sum the numbers for me.