1: [root@DB-Server tmp]# tar -xzvf smem-1.4.tar.gz 2: smem-1.4/.hg_archival.txt 3: smem-1.4/.hgtags 4: smem-1.4/COPYING 5: smem-1.4/smem 6: smem-1.4/smem.8 7: smem-1.4/smemcap.c 8: [root@DB-Server tmp]# cd smem-1.4 9: [root@DB-Server smem-1.4]# ls 10: COPYING smem smem.8 smemcap.c 11: [root@DB-Server smem-1.4]# cp /tmp/smem-1.4/smem /usr/bin 12: [root@DB-Server smem-1.4]# chmod +x /usr/bin/smem
smem工具使用
查看smem命令的相关帮助信息
1: [root@DB-Server tmp]# smem -h 2: usage: smem [options] 3: 4: options: 5: -h, --help show this help message and exit 6: -H, --no-header disable header line 7: -c COLUMNS, --columns=COLUMNS 8: columns to show 9: -t, --totals show totals 10: -R REALMEM, --realmem=REALMEM 11: amount of physical RAM 12: -K KERNEL, --kernel=KERNEL 13: path to kernel image 14: -m, --mappings show mappings 15: -u, --users show users 16: -w, --system show whole system 17: -P PROCESSFILTER, --processfilter=PROCESSFILTER 18: process filter regex 19: -M MAPFILTER, --mapfilter=MAPFILTER 20: map filter regex 21: -U USERFILTER, --userfilter=USERFILTER 22: user filter regex 23: -n, --numeric numeric output 24: -s SORT, --sort=SORT field to sort on 25: -r, --reverse reverse sort 26: -p, --percent show percentage 27: -k, --abbreviate show unit suffixes 28: --pie=PIE show pie graph 29: --bar=BAR show bar graph 30: -S SOURCE, --source=SOURCE 31: /proc data source
1:无参数时显示所有进程的内存使用情况
2:参数-u 显示每个用户所耗用的内存总量
smem -u
3: 参数-p 查看耗用内存情况的百分比。
smem -p
4: 参数-w 查看系统内存使用情况
1: [root@DB-Server01 ~]# smem -w 2: Area Used Cache Noncache 3: firmware/hardware 0 0 0 4: kernel image 0 0 0 5: kernel dynamic memory 22021892 21721584 300308 6: userspace memory 1899296 122424 1776872 7: free memory 686340 686340 0 8: [root@DB-Server01 ~]# smem -w -p 9: Area Used Cache Noncache 10: firmware/hardware 0.00% 0.00% 0.00% 11: kernel image 0.00% 0.00% 0.00% 12: kernel dynamic memory 89.49% 88.27% 1.22% 13: userspace memory 7.73% 0.50% 7.23% 14: free memory 2.78% 2.78% 0.00%