From: franl@centerline.com (Fran Litterio)
Newsgroups: comp.sys.hp
Subject: Re: Process memory usage
Date: 17 Dec 92 15:45:54
Organization: CenterLine Software, Inc.
	<FRANL.92Dec15151723@draco.centerline.com> <17610@umd5.umd.edu>
NNTP-Posting-Host: 140.239.3.116
In-reply-to: mark@roissy.umd.edu's message of 17 Dec 92 19:38:19 GMT

mark@roissy.umd.edu (Mark Sienkiewicz) writes:

> franl@centerline.com (Fran Litterio) writes:
>
> > > I need a way to find how much (virtual) memory is
> > > available and the amount of memory of each process.
> >
> > You want a combination of "/etc/swapinfo -t" (to get total available
> > swap space) and "ps -el" (the SZ column shows process memory usage in
> > 4096-byte blocks -- including the text segment which SunOS does _not_
> > count in the SZ column of its "ps -l" output).
> 
> The ps man page says:
> 
>       SZ    (l)       The size in blocks of the core image of the process.
> 
> Does this mean the number of pages allocated to the process or does this
> mean the number of pages the process has _in_core_?

From my experience, it is the number of 4096-byte blocks (i.e., pages)
allocated to the process.  So it's representative of that process's
swap space usage after you subtract out the size of the process's text
segment (available via size(1)).

> Is there also a way
> to find out the other one?

If you have /usr/contrib/bin/monitor on your system, then you can use
the 'p' command to have it analyse a single process.  It gives a
continuously-updated screenful of info that looks like this (you want
the value shown after "Current resident set size", but do some
experiements to find out if that value include the text segment or not
-- I would guess it does):

Thu Dec 17 15:37:25 1992  9000/720 HP-UX monitor - SINGLE PROCESS INFO   1 of 1

  Resource usage for pid 5621             Started: Thu Dec 17 13:44:28
  Command: xterm -ut -display draco:0.0 -title medusa -n medusa
  User time accumulated:     0:00:00      System time accumulated    0:00:00
  Average CPU usage:              0%      Instantaneous CPU usage:        0%
  Current resident set size:     162      Number of open files:           13

----- Address Space Usage -------
Region    Vaddr    Size Type Vpgs    --------------- Open Files ---------------
  DATA 40001000  446464 PRIV 104     fd  flags type  maj minor    count offset
 UAREA 68fa8000   12288 PRIV   3     0   00001 char  3   0x000002 1     0
 SHMEM 68fad000   20480 PRIV   5     1   00002 file  0   0x000000 23    0
  MMAP 6df62000    8192 PRIV   2     2   00002 file  0   0x000000 23    0
  MMAP 6df64000   40960 PRIV   9     3   00002 file  0   0x000000 23    0
  MMAP 6df6e000   98304 PRIV   5     4   00002 file  0   0x000000 23    0
  MMAP 6df86000    4096 PRIV   1     5   00002 file  0   0x000000 23    0
  MMAP 6df87000   28672 PRIV   5     6   00002 file  0   0x000000 23    0
  MMAP 6df8e000    8192 PRIV   1     7   00002 file  0   0x000000 23    0
  MMAP 6df90000    4096 PRIV   1     8   00002 file  0   0x000000 23    0
  MMAP 6df91000   45056 PRIV  11     9   00002 file  0   0x000000 23    0
  MMAP 6df9c000   12288 PRIV   3     10  00003 socket             1     0
  MMAP 6df9f000   49152 PRIV  12     11  00003 socket             1     148172
NLLDRF        0    4096 SHRD   1     12  00007 char  16  0x000039 1     36637
  TEXT     1000  118784 SHRD  24
  MMAP 80000000   32768 SHRD   7
  MMAP 80008000  655360 SHRD 136
  MMAP 8017f000  258048 SHRD  57
  MMAP 801c8000  307200 SHRD  70
  MMAP 80325000   32768 SHRD   5
  MMAP 8032d000   90112 SHRD  13
--
franl@centerline.com         "So what we've decided to do is set you up in
uunet!centerline!franl        Cicely, situated in an area that we Alaskans
617-498-3255 (USA)            refer to as The Alaskan Riviera."

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: 2.0

mQCNAisQJSUAAAED/jbCQchSwFG7IFKkrCQ6QKLxB0LVbP6co87karNBb88ur1+S
FK82JT9mNlWKvP4HHFEI1kLKk0PAvd0nez/mQIriAMUT2pfOnIAtdqtpddgQseZZ
7BY2vMiorjG7pe6e11Q+UIQcvqsY3Bl89YBgqrydWm8UWMy2qXeXQmAScOodAAUR
tC9GcmFuY2lzIFAuIExpdHRlcmlvLCBKci4gPGZyYW5sQGNlbnRlcmxpbmUuY29t
Pg==
=6hNb
-----END PGP PUBLIC KEY BLOCK-----
Newsgroups: comp.sys.hp