Get CPU and memory usage of the process and its children - githeim/windheim_archive GitHub Wiki
Get CPU and memory usage of the process and its children
How to
pgrep -P $(pgrep -f the_process_name) | xargs ps -o %mem,%cpu,cmd -p | awk '{memory+=$1;cpu+=$2} END {print memory,cpu}'
examples
pgrep -P $(pgrep -f navigation_process) | xargs ps -o %mem,%cpu,cmd -p | awk '{memory+=$1;cpu+=$2} END {print memory,cpu}'
pgrep -P $(pgrep -f localization_process) | xargs ps -o %mem,%cpu,cmd -p | awk '{memory+=$1;cpu+=$2} END {print memory,cpu}'
outputs
0.4 63.5
1 469
first column : memory usage
second column : cpu usage - 469% --> the percentage based on 1 core
it means that localization_process & its children use as many resources as 4 cores(469%)