
Today I was stuck on problem how to calculate the %cpu usage for all httpd threads. The top command shown that I have around 8 httpd process running.
Searching throught forums I found a tip that allow me to get aggregate CPU usage for a particular process.
The ps is used to obtain the result:
ps -C "httpd" -o "pcpu" |sed '1d' |
awk '{sum += $1} END {print sum}'