- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Memory usage per process
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-19-2005 05:20 AM
тАО03-19-2005 05:20 AM
Memory usage per process
I need to know how i can get the memory use per process (Only RAM) and that the add of all process memory is agree with the RAM memory or the Shared Memory.
I can use procsize or ps.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-19-2005 11:53 AM
тАО03-19-2005 11:53 AM
Re: Memory usage per process
# cat /usr/local/bin/processmem
#!/bin/sh
# processmem - display memory claimed by a process
# gwild 03192004
#
if [ $# -lt 1 -o \( $# -gt 1 -a $# -lt 4 \) ]
then
echo "Usage:"
echo "processmem \"process\""
echo "Example:"
echo "processmem rpc"
exit 1
fi
echo " "
PROCESS=$1
mps=0
#for sz in `ps -elf | grep $PROCESS | grep -v grep | awk '{print $10}'`
for sz in `UNIX95= ps -e -o vsz=Kbytes -o ruser -o pid,args=Command-Line | sort -rnk1 | grep -v Kbytes | grep $PROCESS | awk '{print $1}'`
do
mps=`expr $mps + $sz`
done
#echo `expr $mps \* 4096`
echo "\nMemory claimed by $PROCESS: $mps Kbytes.\n"
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-21-2005 09:40 PM
тАО03-21-2005 09:40 PM
Re: Memory usage per process
Or use one of the following:
UNIX95= ps -eo 'vsz pid args' |sort -nr |head -20
UNIX95= ps -e -o "user,pcpu,cpu,vsz,pid,ppid,args" | sort -rnk4
Regards,
David de Beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-15-2005 04:03 AM
тАО11-15-2005 04:03 AM
Re: Memory usage per process
I am trying to use these commands to find out the usage of physical memory by different processors. But in my server when i am trying to run these two command to check for sshd process. One command is showing up the sshd is running and the other one is not at all showing the sshd process. Here i am attaching the output of the commands gathered from my server. Please let me know how to find out sshd process is using the Physical Memory of swap because here when i am running glance its showing up 99% usage of physical memory and 45% on swap.
root# UNIX95= ps -eo 'vsz pid args' |sort -nr |head -20 | grep sshd
root#
root# UNIX95= ps -e -o "user,pcpu,cpu,vsz,pid,ppid,args" | sort -rnk4 | grep sshd | more
root 0.06 0 1708 25528 4569 sshd: agarcia@pts/240
root 0.02 1 1708 28674 4569 sshd: djrobins@pts/578
root 0.02 0 1708 19089 4569 sshd: lanier@pts/394
root 0.02 0 1708 19038 1 sshd: root@pts/91
root 0.02 0 1708 18510 4569 sshd: root@pts/587
root 0.02 0 1708 17804 4569 sshd: root@pts/583
root 0.02 0 1708 5114 4569 sshd: jaleman1@pts/42
root 0.02 0 1708 3226 4569 sshd: dcrawfor@pts/95
root 0.14 0 1644 3430 4569 sshd: eparker@pts/208
root 0.02 0 1644 27640 4569 sshd: dtravers@pts/534
root 0.02 0 1644 23153 4569 sshd: rjanak@pts/485
root 0.02 0 1644 21086 4569 sshd: rplancar@pts/400
root 0.02 0 1644 20666 4569 sshd: kearley@notty
root 0.02 0 1644 18601 4569 sshd: flores@pts/233
root 0.02 0 1644 16969 4569 sshd: scedillo@pts/87
root 0.02 0 1644 11236 4569 sshd: concur@notty
root 0.50 0 1580 17952 4569 sshd: sahlert@pts/325
root 0.29 0 1580 23635 4569 sshd: sbales@pts/239
root 0.18 0 1580 23990 4569 sshd: jquillan@pts/189
root 0.17 0 1580 26601 4569 sshd: nac@pts/417
root 0.16 0 1580 10666 4569 sshd: mweeks@pts/318
root 0.12 0 1580 13314 4569 sshd: btrzebia@pts/430
root 0.11 0 1580 4641 4569 sshd: root@pts/8
root 0.10 0 1580 23392 4569 sshd: klostak@pts/89
root 0.09 0 1580 22326 4569 sshd:
Please clarify my doubt
Thanks in advance
Venkat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-15-2005 11:46 AM
тАО11-15-2005 11:46 AM
Re: Memory usage per process
UNIX95= ps -C sshd -o ruser,pid,ppid,args
As for tring to match memory usage, Unix has many, many memory maps and local process memory is just one. You have to add the buffer cache, the shared libraries, shared executables, memory mapped files, the kernel itself as well as shared memory between programs. It is quite difficult for a simple tool like ps to make sense of all this. For instance, a single program may have 20 copies but only one area of memory contains the instructions (called the text area in HP-UX terms), and that program may be one of dozens of programs that use a single shared library. This memory area cannot be added to a sinlge program's usage as it would not represent true memory usage.
Similarly, a program may access a shared memory area that other programs use. These shared resources are essentially a kernel resource because multiple programs may use these shared areas. Another area is the buffer cache. All programs that read/write files will use the buffer cache.
Your best bet is to look at the Glance stats for each interesting process (ones that consume a lot of memory). Look at the online help for Glance to explain the virtual versus resident set size (VSS, RSS).
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2006 07:07 AM
тАО12-19-2006 07:07 AM
Re: Memory usage per process
UNIX95= ps -eo 'vsz pid args'
appear to give virtual size or count shared memory multiply. Adding the totals in one instance givs a total of 27+ GB on a machine with 8 GB of real memory. (Unless the ps output is off by a factor of about 10: The top output shows about 2.7 GB in use and 3.2 GB free.)
UNIX95= ps -eo 'vsz sz pid args' |\
awk '{mem += $1; pgs += $2};END {printf "% 19d\n", pgs*4}' gives 28144708.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2006 07:09 AM
тАО12-19-2006 07:09 AM
Re: Memory usage per process
On an rp8400, with HP-UX 11.11, the suggested variants of ps such as
UNIX95= ps -eo 'vsz pid args'
appear to give virtual size or count shared memory multiply. Adding the totals in one instance givs a total of 27+ GB on a machine with 8 GB of real memory. (Unless the ps output is off by a factor of about 10: The top output shows about 2.7 GB in use and 3.2 GB free.)
UNIX95= ps -eo 'vsz sz pid args' |\
awk '{mem += $1; pgs += $2};END {printf "% 19d\n", pgs*4}' gives 28144708.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2006 07:42 AM
тАО12-19-2006 07:42 AM