System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Resident process memory Size (RSS) *WITHOUT* Glance/gpm

 
Olivier Decorse
Respected Contributor

Resident process memory Size (RSS) *WITHOUT* Glance/gpm

Hi,
I'm searching how to display, within a shell script, the Resident Size (RSS) of a particular process, WITHOUT using Glance/gpm.
I read a lot of thread about memory size, using UNIX95 and/or ps -l but i seems that they display only Virtual Size (VSS).
I think it is not possible, but let's read unix performance guru responses ...

guaranteed points !!!

Thanks in advance.

Olivier.
They say "install windows 2k, xp or better", so i install unix !
6 REPLIES 6
Fred Ruffet
Honored Contributor

Re: Resident process memory Size (RSS) *WITHOUT* Glance/gpm

"ps -edf -o vsz,args | grep " gives you the core image size in KB. Use sz instead of vsz to have it in pages. It gives something very near from what top displays in RES column, but I don't know wether it's really exact (there are differences between ps and top).

another way is to use glance :)

regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Fred Ruffet
Honored Contributor

Re: Resident process memory Size (RSS) *WITHOUT* Glance/gpm

Oops, I forgot you must set UNIX95...
--

"Reality is just a point of view." (P. K. D.)
Dietmar Konermann
Honored Contributor

Re: Resident process memory Size (RSS) *WITHOUT* Glance/gpm

Olivier,

have a look at the "sz" metric (in pages) provided by ps(1). Also interesting is the "RES" column of top(1). However, there are differences how shared resources are handled... afaik ps(1) ommits them completely while top(1) includes the process' share of them (e.g. a fifth of a shmem segment if currently 5 processes are attached).

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Fred Ruffet
Honored Contributor

Re: Resident process memory Size (RSS) *WITHOUT* Glance/gpm

Dietmar,

As you explain it, I think that sz field (or vsz) of ps is nearest to what Olivier want. IMHO, shared memory must not be included in RSS.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Dietmar Konermann
Honored Contributor

Re: Resident process memory Size (RSS) *WITHOUT* Glance/gpm

Hi, Fred!

You are right... just checked the source to be sure:

...
case FIELD_SZ: (void)printf("%*d", of->width,
(int)(ps->pst_dsize + ps->pst_tsize +
ps->pst_ssize)); break;

case FIELD_VSZ: (void)printf("%*d", of->width,
(int)((ps->pst_vdsize + ps->pst_vtsize +
ps->pst_vssize) * (NBPG / 1024)));
break;
...

So sz is RSS and vsz is VSS... *without* shared resources, just adding data, text and stack.

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Sorrel G. Jakins
Valued Contributor

Re: Resident process memory Size (RSS) *WITHOUT* Glance/gpm

OK, all you kings and wizards, I sort of follow along but I'm a little thick - can some kind soul post a script that will display rss, something nice and simple that an ex-mgr such as I could cut&paste?

No snide remarks from John Payne, please.....