hp-unix中查看内存、CPU的使用率的方法

发布时间:2020-10-06编辑:脚本学堂
hp-unix中查看内存、CPU的使用率的方法,有需要的朋友可以参考下。

hp-unix中查看内存、CPU的使用率的方法,有需要的朋友可以参考下。

1、运行/usr/contrib/bin/crashinfo(根据第二步实际情况) | more,信息中注意类似如下内容:
==================
= Memory Globals =
==================

Note: "freemem" was resynced with freemem caches: was 169536, now 168628

Physical Memory = 2096640 pages (8.00 GB) //物理内存总量
Free Memory = 168628 pages (658.70 MB)//空闲内存
Average Free Memory = 169403 pages (661.73 MB)//平均空闲内存
gpgslim = 7168 pages (28.00 MB)
lotsfree = 32768 pages (128.00 MB)
desfree = 7168 pages (28.00 MB)
minfree = 3328 pages (13.00 MB)
**************物理内存使用率=(物理内存总量-空闲内存)/物理内存总量***************
========================
= Buffer Cache Globals =
========================

dbc_max_pct = 50 %
dbc_min_pct = 5 %
dbc current pct = 50.0 %
bufpages = 1048320 pages (4.00 GB)
Number of buf headers = 557940

fixed_size_cache = 0
dbc_parolemem = 0
dbc_stealavg = 0
dbc_ceiling = 1048320 pages (4.00 GB)
dbc_nbuf = 52416
dbc_bufpages = 104832 pages (409.50 MB)
dbc_vhandcredit = 11403
orignbuf = 0
origbufpages = 0 pages

====================
= Swap Information =
====================

swapinfo -mt emulation
======================

Mb Mb Mb PCT START/ Mb
TYPE AVAIL Used FREE USED LIMIT RESERVE PRI NAME
dev 16384 0 16098 0% 0 - 1 LVM vg00/lv2
reserve - 2141 -2141
memory 6460 4928 1532 76%
total 22844 7069 15489 31% - 0 -
*****************SWAP内存使用率就是total的PCT值:31%*************************

2、CPU的使用率可以从top参数得出:
System: JXCNMD1 Fri Aug 17 10:25:02 2007
Load averages: 0.35, 0.41, 0.44
311 processes: 257 sleeping, 53 running, 1 zombie
Cpu states:
CPU LOAD USER NICE SYS IDLE BLOCK SWAIT INTR SSYS
0 0.74 8.8% 3.8% 2.0% 85.5% 0.0% 0.0% 0.0% 0.0%
1 0.17 4.4% 6.2% 10.2% 79.3% 0.0% 0.0% 0.0% 0.0%
2 0.12 3.8% 1.0% 1.0% 94.2% 0.0% 0.0% 0.0% 0.0%
3 0.36 0.0% 70.9% 28.1% 1.0% 0.0% 0.0% 0.0% 0.0%
--- ---- ----- ----- ----- ----- ----- ----- ----- -----
avg 0.35 4.2% 20.6% 10.2% 65.1% 0.0% 0.0% 0.0% 0.0%
*****************系统一共4个CPU,每个CPU的使用率=100%-IDLE值*******************

3、top命令的一些解释
问:
top中的几个参数的意义能帮忙解释一下吗?
主要是对 free的计算方法不太理解,机器的物理内存有256M,free中的33M是怎么计算出来
的呢?

Memory: 92764K (15880K) real, 65796K (13316K) virtual, 33684K free Page# 1/5

另外,SAM中有如下有关信息:
xx x Processor xx Memory xx Operating System xx Network xx Dynamic x x
xx lqqqqqqqqqqqq/ qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
xx xlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkx x
xx xxPhysical Memory: 256.2 MB xx x
xx xxReal Memory: xx x
xx xx Active: 21113.5 KB xx x
xx xx Total: 97083.5 KB xx x
xx xxVirtual Memory: xx x
xx xx Active: 16247.3 KB xx x
xx xx Total: 68390.7 KB xx x
xx xxFree Memory Pages: 6738 at 4 KB/page xx x
xx xxSwap Space: xx x
xx xx Avail: 1024 MB xx x
xx xx Used: 231 MB xxvx
xmqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqjx

其中的Virtual Memory和 Swap Space是什么关系呢?我想计算虚拟内存的利用率该如何计算呢?

回答:
top 只能看到进程所使用的内存量,所以你看到的 92764K (15880K) real 就是所有进程所使用的内存总和,这个内存是指物理内存,括号前那个值是Total Real Memory,括号内是Active Real Memory, 这两者的区别就在于Active Real Memory的值只是分配给那些已经在run queue或者正在运行的进程的Real Memory,而Total Real Memory 包括所有的进程。
对于后一项值 65796K (13316K) virtual 的解释也是同样的,不过这个值代表了Virtual Memory(一般为建在Disk上的Swap空间,当然你要问了,我的Swap空间可不止这么些啊 by executing ‘swapinfo‘, 没错,Swap空间是大于这里的Total Vitual Memory的,但我前面说了,这里的值只是计算的分配给进程的),最后一项33684K free 到确确实实是Free 的Memory,它等于Physical Mem - kernel used - user used - buffer cache。

下面是对SAM->;Performance Monitor ->; System Property ->; Memory的显示结果的解释

Physical Memory 256.2 MB 实际物理内存大小
Real Memory
Active: 21113.5 KB 同 top (当然这里举的例子由于有时间差,所以看上去不大一致)
Total: 97083.5 KB 同 top
Virtual Memory:
Active: 16247.3 KB 同 top
Total: 68390.7 KB 同 top
Free Memory Pages: 6738 at 4 KB/page 6738 * 4 就是 top 显示出来的结果
Swap Space:
Avail: 1024 MB 同Swapinfo中 dev filesystem 总和(一般不会用到Pseudo Memory),为实际Swap Space 的大小。
Used: 231 MB 同Swapinfo中的Reserve, 为系统在创建进程时为该进程预留的Swap 空间总和)