Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Can I get the amount of memory used by the system on AIX 6

Status
Not open for further replies.

chavax

Programmer
Jan 17, 2002
9
US
Hi !!!!
We are working on a program on charge to get the total amount of memory used by the system AIX.

We know the existance of svmon command and swapqry (function) but the problem is that we are not sure which one is the real amount of total memory used in the System.

I'll appreciate your help on this problem. By the way, There is a way to implement this directly from a function or program in C or Visual Age C++ for AIX?

Thanks in advance....
 

in anyway the vmstat will give u snap shot of memory usage at that point of time.

best way is use.. "topas" for observing the memory usage for a period of time. then caluculate for average amount of memory usage.

i think it will help you.

nagaraj
 
Use this script. It gives an output of which application or process is using how much memory .We are using this script in our project.

#!/usr/bin/ksh

# Orders and sums the real and virtual memory used by Application processes
# and writes to standard out.
#


header=" PID TTY STAT TIME PGIN SIZE RSS LIM TSIZ TRS %CPU %MEM C
OMMAND"
Total=0

echo " Program PID Kilobytes"
ps gvw | egrep -v PID\|grep\|kproc | sort -k 6rn -k 7rn|
while read line
do
if [ "$flag" != 1 ]
then
maxLine=$line
flag=1
fi
Size=`echo $line|awk '{print $6}'`
if [ ! -z "$Size" -a "$Size" != xx ]
then
((Total=Size+Total))
Program=`echo $line|awk '{print $13}'`
Program=`basename $Program`
Pid=`echo $line|awk '{print $1}'`
printf "%30s\t%6s\t%-d\n" $Program $Pid $Size
fi
done

Program=`echo $maxLine|awk '{print $13}'`
ProgramMax=`echo $maxLine|awk '{print $6}'`
Program=`basename $Program`
printf "%30s\t\t%-d %s\n" Total $Total kilobytes
# End of Program

The output will be like this

Program PID Kilobytes
mmfsd 12326 19468
Xvnc 55848 9512
hatsd 14478 7548


I hope it helps

Naveen.R.T
 
Hi,

Just use the command : bootinfo -r as root

 
naveenrt,

I would give you a another star if I could.. thats a pretty neat script. Thanks for posting it!

Tcorum

:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top