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
附件1:查看物理内存总量
# 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
附件2:查看每个用户占用物理内存的数量
# 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