I'm trying to calculate the amount of memory used by AMP in an LAMP stack machine.
top -bn1 | grep -E '(mysql|httpd|php)' | awk '{mem += $(NF-2)} END {print mem}'
But the sum generated using the above command is greater than 100%, but I was expecting something below 100% since individual processes memory usage is already represented in % by top
.
Please help me understand whether memory reported by top
can't be used this way to calculate the memory usage?