免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1961 | 回复: 5
打印 上一主题 下一主题

[SCO UNIX] 求教:怎么样查看系统每个进程所消耗的内存,谢谢! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-12-19 09:05 |只看该作者 |倒序浏览
求教:怎么样查看系统每个进程所消耗的内存,谢谢!

论坛徽章:
0
2 [报告]
发表于 2005-12-19 11:04 |只看该作者
top

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
3 [报告]
发表于 2005-12-19 11:05 |只看该作者
用crash可以查看,比如查看login进程占用的内存:
原文见:
http://wdb1.sco.com/kb/showta?ta ... 3893943&pgnum=1
# crash

dumpfile /dev/mem, namelist = /unix, outfile = stdout


The next command displays the process slot (first field) for each login process. As there are a number of login processes on the system used here, only one is shown below:

> proc | grep login (查看login进程,这里可以换成你关心的进程程序名)
.
.
366 s 20303 20302 20303     0  73   0 proc+0x1ebd0     login          load
.


The pregion command (the abbreviated form is used here) shows which regions are attached to this process:

> preg 366
SLOT       PREG REG#      REGVA  TYPE FLAGS
366        0    2321  0x8046000 stack rd wr cm
           1    1123  0x8048000  text rd ex cm
           2     935  0x8056000  data rd wr cm
           3    2401 0x80001000 lbtxt rd ex pr wa
           4    2451 0x80054000 lbdat rd wr ex pr wa
           5    3598 0x8005f000 lbtxt rd ex pr wa
           6     907 0x80089000 lbdat rd wr ex pr wa
           7    1966 0x80092000 lbtxt rd ex pr wa
           8    3042 0x800c7000 lbdat rd wr ex pr wa


This region command prints the region table entries for the above:

> reg 2321 1123 935 2401 2451 3598 907 1966 3042
REGION TABLE SIZE = 3754
Region-list:

SLOT  PGSZ VALID  SMEM NONE SOFF  REF SWP NSW FORW BACK INOX TYPE FLAGS
2321     2     2     2    0   70    1   0   0 1965  905   -  priv nosh stack
1123    14    14     0    0   72    1   0   0 1382  935  481 stxt nosh nosmem
935     18    18    18    0   86    1   0   0 1123 1474  481 priv nosh
2401    83    66     0    0    1    1   0   0 1861 2451   20 map  nosh nosmem
2451    10    10     9    0   84    1   0   0 2401 2426   20 map  nosh
3598    42    36     0    0   95    1   0   0 2684  907   16 map  nosh nosmem
907      8     8     6    0  137    1   0   0 3598 3233   16 map  nosh
1966    53    42     0    0  146    1   0   0  674 3042   14 map  nosh nosmem
3042    10     8     6    0  199    1   0   0 1966 2669   14 map  nosh


The VALID column refers to the number of 4KB pages actually residing in memory. The pages corresponding to the regions shown as lbtxt in the pregion output (slots 2401, 3598 and 1966) are typically shared among many other processes, however. It would therefore be inaccurate to attribute them just to the login process (in this instance the libraries happen to be libprot, libsocket and libc).
To calculate the memory used by the first instance of the login program, sum the entries in the VALID column, excluding the lbtxt ones. This gives 2+14+18+10+8+8 = 60 pages = 240KB.

The SMEM column shows how many non-shared pages are being used by the process. It therefore excludes the lbtxt regions, as well as login's own .text region (corresponding to the actual login program code, as this is automatically shared by subsequent login processes).

The SMEM and VALID columns also differ in the rows corresponding to regions labeled "lbdat" in the pregion output (and labeled as TYPE/FLAGS = map nosh in the region output), by 1+2+2 pages = 20KB. This difference corresponds to read/write shared data which has never been written to, and therefore is shareable among all login processes. For example, region #907 is 8 pages long (PGSZ), 8 of which are VALID, and 6 of which are SMEM (have been copied-on-write and become private, as a result of having been written to by this process).

To calculate the memory used by second and subsequent login processes, sum the entries in the SMEM column. The result is 41 pages = 164 KB.

To summarize, we have learned that on the test system, login consumes 240KB of memory for the first instance and 164KB each for additional processes.

[ 本帖最后由 CNL 于 2005-12-19 11:10 编辑 ]

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
4 [报告]
发表于 2005-12-19 11:43 |只看该作者
原帖由 冷月无声 于 2005-12-19 11:04 发表
top

用top不如用hog
ftp://ftp2.sco.com/pub/skunkware/osr5/vols/

论坛徽章:
0
5 [报告]
发表于 2005-12-19 18:03 |只看该作者
ps -la 也可以。

crash..让我受益。

[ 本帖最后由 zhhui2000 于 2005-12-19 18:05 编辑 ]

论坛徽章:
0
6 [报告]
发表于 2005-12-20 16:21 |只看该作者

谢谢,各位

谢谢,各位谢谢,各位谢谢,各位谢谢,各位谢谢,各位
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP