Operating System - HP-UX
1833238 Members
2700 Online
110051 Solutions
New Discussion

Re: which command to show memory staus

 
張朝家
Occasional Advisor

which command to show memory staus

Hi
which command I can run to show the physical memory and used memory realtime on hpux 11i

sar or top or other else ,no answer from these command

8 REPLIES 8
V. Nyga
Honored Contributor

Re: which command to show memory staus

Hi,

I use:
'swapinfo -tam'
'ps -el'
'vmstat -n'

Check the man-pages for details.

HTH
Volkmar
*** Say 'Thanks' with Kudos ***
Anshumali
Esteemed Contributor

Re: which command to show memory staus

what a nice name you have picked up!!

you can use glance -m, if you have glance...

Thanks,
Anshu
Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
V. Nyga
Honored Contributor

Re: which command to show memory staus

Hi again,

for the physical memory it depends on the os you have. With a search here in itrc you'll find several commands.
Here's my script for HP-UX 11.11, see attachment.

HTH
Volkmar
*** Say 'Thanks' with Kudos ***
Srikanth Arunachalam
Trusted Contributor

Re: which command to show memory staus

Hi,

you can make use of sar for this purpose.

sar 2 5 (will give you the percentage of memory used of 5 slices once in 2 seconds).

When customers cry for performance problem. I immediately check this sar output and based on % mem free output, I check the average % mem used as 100 - (%mem free).

Thanks,
Srikanth
Kapil Jha
Honored Contributor

Re: which command to show memory staus

Why no answer from top.
I suppose top is a nice tool.
Well you may use
#swapinfo -amt

BR
Kapil
I am in this small bowl, I wane see the real world......
Don Morris_1
Honored Contributor

Re: which command to show memory staus

top isn't the best tool for system analysis, as it reports memory from only the User Process point of view (Active Virtual and Active Real is only for User memory, System usage is not shown at all). In this case, you can get free memory from top, however... since that's the same either way.

A bit easier to just write a basic C or perl program that uses pstat. pstat_getvminfo() returns a pst_vminfo structure, which contains psv.cfree as a field -- that's Free physical pages. pstat_getstatic() returns a pst_static which has physical_memory as the total pages.
I'd highly recommend using a programmatic interface for forward compatibility -- since on 11.31 and later, physical_memory is no longer constant at run time, after all.

swapinfo is about the worst thing I can think of to try to pull this information since the Memory line in that output is pseudo-swap, not physical memory. They aren't the same, and the counts will be completely different.

And one final mention -- used memory via any of these interfaces (save Glance if you read it carefully, I would think) can be misleading. Just because memory is in use doesn't mean the system can't free it up quickly (the file cache is what's coming to mind here -- if you're using dynamic buffer cache or dynamic file cache, it is supposed to hold onto pages for better caching until there's some actual memory pressure [or close to it]. Free memory running down to the pressure point isn't unexpected or bad in those cases -- and it doesn't mean a new User application can't get pages).
Geoff Wild
Honored Contributor

Re: which command to show memory staus

And here's a little program I use called memdetail. It is a c program - compiles with the built in HP-UX compiler.

cc memdetail1.c

mv a.out /usr/local/bin/memdetail

Output like:

# memdetail
Memory Stat total used avail %used
physical 40958.0 28445.2 12512.8 69%
active virtual 30213.0 8304.0 21909.1 27%
active real 19827.2 6694.1 13133.0 34%
memory swap 40958.0 15385.0 25573.0 38%
device swap 83964.0 31218.8 52745.2 37%



Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
whiteknight
Honored Contributor

Re: which command to show memory staus

Hi æ å®¶,

Simple way

SAM -> Performance Monitors -> system Properties -> Memory

(You can toggle to refresh the status)

WK

Problem never ends, you must know how to fix it