安装(源码为绿色版,解压即可使用, 也可通过yum安装)
[root@vm98 test]# ls
smem-1.4.tar.gz
[root@vm98 test]# tar xvf smem-1.4.tar.gz
smem-1.4/.hg_archival.txt
smem-1.4/.hgtags
smem-1.4/COPYING
smem-1.4/smem
smem-1.4/smem.8
smem-1.4/smemcap.c
[root@vm98 test]# ls
smem-1.4 smem-1.4.tar.gz
[root@vm98 test]# cd smem-1.4/
[root@vm98 smem-1.4]# ls
COPYING smem smem.8 smemcap.c
使用方法
- 不指定用户(显示所有用户)
[root@vm98 smem-1.4]# ./smem -tk -u
User Count Swap USS PSS RSS
postgres 8 0 304.4M 459.4M 770.5M
root 67 442.0M 1.7G 1.8G 1.9G
---------------------------------------------------
90 442.7M 2.2G 2.4G 3.0G
- 指定用户
[root@vm98 smem-1.4]# ./smem -tk -U postgres
PID User Command Swap USS PSS RSS
15097 postgres postgres: logger 0 200.0K 586.0K 3.6M
15104 postgres postgres:logical replicati 0 480.0K 1.4M 5.8M
15102 postgres postgres: autovacuum launch 0 800.0K 2.0M 6.9M
15103 postgres postgres: stats collector 0 2.4M 2.8M 5.7M
15101 postgres postgres: walwriter 0 208.0K 8.6M 20.1M
15100 postgres postgres: background writer 0 216.0K 45.6M 137.3M
15099 postgres postgres: checkpointer 0 73.9M 117.9M 208.8M
15095 postgres /home/postgres/pgsql/bin/po 0 226.3M 280.5M 382.4M
-------------------------------------------------------------------------------
8 1 0 304.4M 459.4M 770.5M
比如我问你环境中 PG 占用了多少内存, 根据上面显示, 内存为 459.4M