http://www.pixelbeat.org/scripts/
Try to determine how much RAM is currently being used per program.
Note per program, not per process.
So for example this script will report RAM used by all httpd process together.
In detail it reports: sum(private RAM for program processes) + sum(Shared RAM for program processes)
The shared RAM is problematic to calculate, and this script automatically selects the most accurate method available for your kernel.

方案1:
V3.9 – 07 Mar 2017
wget https://raw.githubusercontent.com/pixelb/ps_mem/master/ps_mem.py
chmod +x ps_mem.py
./ps_mem.py

方案2:
git clone https://github.com/pixelb/ps_mem.git

cd ps_mem

./ps_mem.py

Private + Shared = RAM used Program

4.0 KiB + 11.5 KiB = 15.5 KiB uuidd
25.4 MiB + 882.5 KiB = 26.3 MiB salt-minion
1.2 GiB + 473.5 KiB = 1.2 GiB mysqld
2.7 GiB + 12.6 MiB = 2.8 GiB java (2)

4.0 GiB