标签:查看aix内存
1,从大到小排列10个内存使用率进程ps aux | head -1 ; ps aux | sort -rn +3 | head -10
如详细查看进程:
ps -ealf | head -1 ; ps -ealf | sort -rn +9 | head -10
# ps aux | head -1 ; ps aux | sort -rn +3 | head -10 USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND root 6553834 0.1 3.0 115064 115080 - A Feb 20 86:08 /var/opt/tivoli root 5701730 0.0 1.0 17480 21956 - A Mar 05 1:17 /opt/BESClient/ pconsole 4456680 0.0 1.0 42456 42464 - A Feb 20 3:11 /usr/java5/bin/ root 6750376 0.0 0.0 796 824 pts/0 A 11:29:26 0:00 ps aux root 6488234 0.0 0.0 260 268 - A Mar 13 0:02 auditbin root 6357208 0.0 0.0 236 248 pts/0 A 11:29:26 0:00 sort -rn +3 root 5963962 0.0 0.0 1768 1804 - A Feb 20 0:00 /usr/sbin/rsct/ root 5832798 0.0 0.0 836 856 - A 11:29:12 0:00 telnetd -a root 5570748 0.0 0.0 2128 2096 - A Feb 20 0:00 /usr/sbin/rsct/ root 5308652 0.0 0.0 7328 7436 - A Feb 20 1:01 /usr/sbin/rsct/
2,根据某个命令或进程名,查看内存使用率
# ps aux | head -1 ; ps aux | grep topas
如详细查看:
USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND root 2359426 0.0 0.0 1440 1272 - A Feb 20 1:08 /usr/bin/topasr root 6160578 0.0 0.0 252 264 pts/0 A 11:36:45 0:00 grep topas
但有的时候ps aux并不能非常详细地表现出进程的完整使用率
3,通过root用户svmon用户可以分析出内存使用量
# svmon -G size inuse free pin virtual mmode memory 1048576 1037487 11089 229668 378796 Ded pg space 2097152 2360 work pers clnt other pin 196952 0 0 32716 in use 378796 0 658691 PageSize PoolSize inuse pgsp pin virtual s 4 KB - 793327 2360 49188 134636 m 64 KB - 15260 0 11280 15260
inuse:是物理内存使用量,这里是以4K为单位,所以 1037487*4096=4249546752(424M)
virtual:是虚拟内存使用量,这里是以4K为单位,所以 378796*4096=1551548416(155M)
4,显示使用物理内存最多的3个进程:
# svmon -uP -t 3|grep -p Pid|grep '^.*[0-9] ' 6553834 java 51279 8917 0 50938 N Y N 4456680 java 34626 8874 0 34608 N Y N 5701730 BESClient 29564 8882 0 25689 Y Y N
输出的格式顺序为 Pid Command Inuse Pin Pgsp Virtual 64-bit Mthrd
可以计算出X程序所使用的实存为51279×4096=210038784,约为210MB
5,显示交换区使用物理内存最多的3个进程
# svmon -gP -t 3|grep -p Pid|grep '^.*[0-9] ' 1966206 shlap64 26782 8880 0 26771 Y N N 0 swapper 9872 8912 0 9872 Y N N 1 init 22094 8836 0 22076 N N N
第一个程序X所使用的交换区大小约为 26782×4096 =10510336 字节,大约为10MB空间
6,每隔三秒显示使用最多的段
# svmon -S -t 3 -i 3 Vsid Esid Type Description Inuse Pin Pgsp Virtual 4f08 - clnt 37505 0 - - 11e1 - clnt 33623 0 - - 8811 - work kernel pinned heap 12637 6547 8091 19397
可见,Vsid为4f08的段使用最多
7,svmon -pP 22674
看PID为22674的进程所使用的为那些文件
Pid Command nuse Pin Pgsp Virtual 64-bit Mthrd 22674 java 29333 1611 2756 32404 N Y Vsid Esid Type Description Inuse Pin Pgsp Virtual 0 0 work kernel seg 2979 1593 1659 4561 a056 - work 43 16 3 46 1e03 2 work process private 77 2 17 93 1080 - pers /dev/hd2:69742 1 0 - - f8bd f work shared library data 84 0 11 99 60ee 8 work shmat/mmap 0 0 0 0 70ec - pers /dev/hd2:69836 1 0 - -
8,通过ncheck命令,检查Vsid都使用了哪些文件。
ncheck a056
查看物理内存总量
# cat mem1.sh #!/usr/bin/ksh #mem totle totalmem=$(vmstat -v|head -n 1|awk '{print $1/256}') echo "mem totle:" echo $totalmem MB echo
查看每个用户占用物理内存的数量
# cat mem2.sh usermem=$(for username in `cat /etc/passwd|awk -F: '{print $1}'` do svmon -U $username|grep $username" " done) usermem=`echo "$usermem"|grep -v "0 0 0 0"|awk '{print $1,$2/256,"MB"}'` echo "singe user pmem" echo "$usermem" usermem=$(echo "$usermem"|awk 'BEGIN{sum1=0;}{sum1=sum1+$2;}END{print sum1;}') usermem=$(echo $usermem|awk -F\. '{print $1}') echo "singe user pmem :" $usermem MB echo
AIX5.3下查看系统、用户、文件系统占用内存数量
#!/usr/bin/ksh #查看总的内存数量: totalmem=$(vmstat -v|head -n 1|awk '{print $1/256}') echo "总内存(物理内存):" echo $totalmem MB echo #查看各用户使用的内存: usermem=$(for username in `cat /etc/passwd|awk -F: '{print $1}'` do svmon -U $username|grep $username" " done) usermem=`echo "$usermem"|grep -v "0 0 0 0"|awk '{print $1,$2/256,"MB"}'` echo "各用户内存(物理内存):" echo "$usermem" usermem=$(echo "$usermem"|awk 'BEGIN{sum1=0;}{sum1=sum1+$2;}END{print sum1;}' ) usermem=$(echo $usermem|awk -F\. '{print $1}') echo "用户内存(物理内存)合计:" $usermem MB echo #查看文件系统缓存: clientmem1=`svmon -G|grep "^pin"|awk '{print $4}'` clientmem2=`svmon -G|grep "^in use"|awk '{print $5}'` clientmem=`expr $clientmem1 + $clientmem2` clientmem=`expr $clientmem / 256` echo "文件系统缓存(物理内存):" echo $clientmem MB echo #查看系统使用内存: sysmem=$(svmon -S -s -u|cut -b 54-|grep -v "0 0 0 0"|grep [0-9]|awk '{print $1,$2}') supremeseg=`echo "$sysmem"|grep S|awk 'BEGIN{sum1=0;}{sum1=sum1+$2;}END{sum1=sum1*16*1024*1024;print sum1;}'` largeseg=`echo "$sysmem"|grep L|awk 'BEGIN{sum1=0;}{sum1=sum1+$2;}END{sum1=sum1*16*1024;print sum1;}'` mediumseg=`echo "$sysmem"|grep m|awk 'BEGIN{sum1=0;}{sum1=sum1+$2;}END{sum1=sum1*64;print sum1;}'` smallseg=`echo "$sysmem"|grep s|awk 'BEGIN{sum1=0;}{sum1=sum1+$2;}END{sum1=sum1*4;print sum1;}'` sysmem=$(expr $supremeseg + $largeseg + $mediumseg + $smallseg) sysmem=$(expr $sysmem / 1024) echo "系统内存(物理内存):" echo $sysmem MB echo #查看空闲内存: freemem=$(vmstat -v|grep free|awk '{print $1/256}') echo "空闲内存(物理内存):" freemem=$(echo $freemem|awk -F\. '{print $1}') echo $freemem MB echo
标签:查看aix内存
原文地址:http://blog.51cto.com/liuqun/2046198