Operating System - HP-UX
1828667 Members
1875 Online
109984 Solutions
New Discussion

how to get the total memory usage used by one process user

 
SOLVED
Go to solution
YLTan
Frequent Advisor

how to get the total memory usage used by one process user


I have a server running asoftware which spawn off numerous processes with one common userID. I have also perfview installed.

How to find out how much memory is used by one particular user?
tyl
8 REPLIES 8
Piergiacomo Perini
Trusted Contributor

Re: how to get the total memory usage used by one process user

Hi,

with comand:

top


you can read the column SIZE for any process.
This tell you total size of process in kb and
this include text, data and stack.

Hope this help you.
Umapathy S
Honored Contributor

Re: how to get the total memory usage used by one process user

If I understand your question correctly, then
UNIX95= ps -ef -o vsz,args,user|grep root

will do.

glance will the correct output.

HTH,
Umapathy
Arise Awake and Stop NOT till the goal is Reached!
Hoefnix
Honored Contributor

Re: how to get the total memory usage used by one process user

Better is to do it with ps -elf | grep "user_id"

ps -elf | grep "user_id" | awk 'BEGIN {total=0} { total+=$9 } END {printf "Total=%u\n",total}'

Gives total in bytes
Hoefnix
Honored Contributor

Re: how to get the total memory usage used by one process user

sorry I counted wrong.
ps -elf | grep user | awk 'BEGIN {total=0} { total+=$10 } END {printf "Total=%u\n",total}'

Gives total in bytes.
Chris Wilshaw
Honored Contributor

Re: how to get the total memory usage used by one process user

Given the above replies, you will get a slight inaccuracy.

You either need to use grep -v grep to avoid getting the grep process itself, or a better option is to use

ps -u

as this negates the grep requirement

eg:

ps -flu | awk .......

or

UNIX95= ps -u -o vsz,args,user
Mike Stroyan
Honored Contributor
Solution

Re: how to get the total memory usage used by one process user

Note that the "total" memory for a group of processes can be a very deceptive number. There may be a number of shared memory segments which are common to many processes. Those may be unreported or reported multiple times, depending on the tool you use. Newer top and ps patches include more memory regions in the vsz number than older versions. You should also be clear whether you want to see the RAM resident set size or the virtual address size.

The attached program reports both RAM and virtual memory sizes. It divides the size of shared memory segments by the number of processes that have them attached.
常有慈悲心
Regular Advisor

Re: how to get the total memory usage used by one process user

Hi,Doud,

where i can get the doc "KBAN00000700" ?
YLTan
Frequent Advisor

Re: how to get the total memory usage used by one process user

Hi Mike,

I compiled your prog. Can you tell me the desc for each of the memory colume and how are they related to each other like shared_vm, shared_ram, private_vm, private_ram and res_mem... does res_mem = shared_ram + private_ram?
tyl