- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Calculating Real Memory Usage
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
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
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
07-19-2007 03:11 AM
07-19-2007 03:11 AM
Calculating Real Memory Usage
I would like my numbers to match up with Glance's output under the RSS column.
I am having a lot of trouble making this happen, so far my calculation is:
procMem = (((double) (pst.pst_dsize + pst.pst_ssize + pst.pst_tsize)) * getpagesize()) / (1024 * 1024)
In my mind, this calculation gets all the real space used by the process and converts the returned page numbers into megabytes.
However, this calculation returns sizes much larger than the RSS column in Glance for the exact same PID's.
Please advise on how Glance is calculating RSS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2007 06:09 AM
07-19-2007 06:09 AM
Re: Calculating Real Memory Usage
Can anyone advise me on some C logic to correctly calculate shared memory usage to not overstate things?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2007 07:19 AM
07-19-2007 07:19 AM
Re: Calculating Real Memory Usage
# 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 `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"
Does that not give you the same?
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2007 08:08 AM
07-19-2007 08:08 AM
Re: Calculating Real Memory Usage
I was using ps before, however I don't think the values were matching (perfectly).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2007 08:25 AM
07-19-2007 08:25 AM
Re: Calculating Real Memory Usage
For example, I ran your script with the process name of an Oracle database. The script claims that all of these processes put together claim over 9 Gigabytes of memory. I'm pretty sure Glance isn't reporting the same number for RSS.
When using sz it provides a more reasonable number of 2 Gigabytes which is more in tune with Glance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2007 04:11 AM
07-27-2007 04:11 AM
Re: Calculating Real Memory Usage
says this about RSS:
RSS = sum of private region pages +
(sum of shared region pages /
number of references)
The number of references is a count of the number of attachments to the memory region. Attachments, for shared regions, may come from several processes sharing the same memory, a single process with multiple attachments, or combinations of these.
This value is only updated when a process uses CPU. Thus, under memory pressure, this value may be higher than the actual amount of resident memory for processes which are idle because their memory pages may no longer be resident or the reference count for shared segments may have changed.
On HP-UX, this metric is specific to a process. If this metric is reported for a kernel thread, the value for its associated process is given.
A value of â naâ is displayed when this information is unobtainable. This information may not be obtainable for some system (kernel) processes. It may also not be available for
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2007 06:10 AM
07-27-2007 06:10 AM