svmon 命令提供了一个更加深入的内存使用情况的分析。比起 vmstat 和 ps 命令,它带有更多信息量,并且更具有强制性。svmon 命令捕获一个当前内存状态的快照。然而,这并不是一个真正的快照,因为它运行在用户级别,即中断允许状态。
下面举例说明使用命令可做的一些工作:
1、# svmon -uP -t 3|grep -p Pid|grep '^.*[0-9] '
可将使用实存最多的三个进程标出
5428 X 4681 1584 2656 9156 N N
16274 bin 4594 1588 2273 8824 N Y
6458 dtgreet 4660 1580 2144 8712 N N
输出的格式顺序为 Pid Command Inuse Pin Pgsp Virtual 64-bit Mthrd
可以计算出X程序所使用的实存为4681×4096=18763776,约为18MB
2、# svmon -gP -t 3|grep -p Pid|grep '^.*[0-9] '
可将使用交换区最多的三个进程标出,
5428 X 4681 1584 2656 9156 N N
16274 bin 4594 1588 2273 8824 N Y
6458 dtgreet 4660 1580 2144 8712 N N
第一个程序X所使用的交换区大小约为 2566×4096 =10510336 字节,大约为10MB空间
3、# 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的段使用最多
4、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 - -
A page is a block of virtual memory while a frame is a block of real memory. Frames have always a size of 4
KB whereas pages may have different sizes. The base page size is 4 KB. All pages inside a segment have the
same size.
Values reported by svmon are expressed in 4KB units unless they explicitly pertain to a specific page size,
in which case they are expressed in pages of this specific size. For example, in the following report, the
first section is expressed in 4KB units. The second and third sections are expressed in pages of PageSize and
Psize, respectively.
Process Report
The process report is printed when the -P flag is specified. The column headings in a process report are:
Pid
Indicates the process ID.
Command
Indicates the command the process is running.
Inuse
Indicates the total number of pages in real memory in segments that are used by the process.
Pin
Indicates the total number of pages pinned in segments that are used by the process.
Pgsp
Indicates the total number of pages reserved or used on paging space by segments that are used by the
process.
Virtual
Indicates the total number of pages allocated in the process virtual space.
64-bit
Indicates if the process is a 64 bit process (Y) or a 32 bit process (N).
Mthrd
Indicates if the process is multi-threaded (Y) or not (N).
16MB
Indicates the 16MB page status of the process. "M" stands for mandatory, "Y" means that the process uses
or has used 16MB page segments and "N" means that the process does not use 16MB pages.
If the process uses pages of a size other than the base 4KB page size, these statistics are followed by
the distribution between the different page sizes.
理想状态下Pgsp为0时,Inuse值就是消耗的实际内存