4 ms·
That is correct. I actually spend half a day trying to find a way to get aggregate memory usage of Safari. You can get most of Safari processes using plain ps
by freediver 6y ago
That is correct. I actually spend half a day trying to find a way to get aggregate memory usage of Safari.
You can get most of Safari processes using plain ps as they share the same command:
ps x -o rss,command | grep Safari
There will be a few system threads (for example used for video rendering) that you will have to tie back to one of the processes using launchctl.
Fun fact: activity monitor actually does it through undocumented private APIs as documented here: https://apple.stackexchange.com/questions/327290/how-process-hierarchy-works-in-macos https://apple.stackexchange.com/questions/327290/how-process...
Hope it saves someone half a day!
- saagarjha 6y agoThe kernel actually keeps track of this information in an internal "responsibility" field for each process. The private API to retrieve this information (which Activity Monitor uses) is responsibility_get_pid_responsible_for_pid, exported from /usr/lib/system/libquarantine.dylib.