Operating System - HP-UX
1827798 Members
2344 Online
109969 Solutions
New Discussion

How to see total memory usage..

 
Arun Jain
Frequent Advisor

How to see total memory usage..

Dear All,

I have 8 Gb main memory and 9 GB (4+5) memory in swap, 17 Gb in total. Now the problem is when I run "swapinfo -tam", it shows only memory usage by swap space but it doesn't include main memory.
while in other servers it shows main memory also.
now tell what is the reason and how can I check total memory usage in that server.

Regards,
Arun Jain
speak less say more
19 REPLIES 19
skt_skt
Honored Contributor

Re: How to see total memory usage..

which HP-UX version
Arun Jain
Frequent Advisor

Re: How to see total memory usage..

HP-UX B.11.00

but other servers contain either B.11.11 or B.11.23
speak less say more
Yogeeraj_1
Honored Contributor

Re: How to see total memory usage..

hi Arun,

try:
glance -m

e.g.

--------------------------------------------------------------------------------
CPU Util S | 1% 2% 4%
Disk Util F | 2% 1% 2%
Mem Util S SU UB B | 19% 19% 19%
Swap Util URR | 5% 5% 5%
--------------------------------------------------------------------------------
MEMORY REPORT Users= 2
Event Current Cumulative Current Rate Cum Rate High Rate
--------------------------------------------------------------------------------
Page Faults 111 169 24.6 28.6 41.4
Page In 28 52 6.2 8.8 17.1
Page Out 0 0 0.0 0.0 0.0
KB Paged In 0kb 0kb 0.0 0.0 0.0
KB Paged Out 0kb 0kb 0.0 0.0 0.0
Reactivations 0 0 0.0 0.0 0.0
Deactivations 0 0 0.0 0.0 0.0
KB Deactivated 0kb 0kb 0.0 0.0 0.0
VM Reads 0 0 0.0 0.0 0.0
VM Writes 0 0 0.0 0.0 0.0

Total VM : 1.20gb Sys Mem : 728.8mb User Mem: 451.6mb Phys Mem: 8.00gb
Active VM: 1.03gb Buf Cache: 409.6mb Free Mem: 6.45gb Page 1 of 1


hope this helps!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Arun Jain
Frequent Advisor

Re: How to see total memory usage..

Hi yogeeraj,

thanks for the help but glance version is expired in the system.

is there any other method, then plz suggest.

Regards:
Arun
speak less say more
Yogeeraj_1
Honored Contributor

Re: How to see total memory usage..

hi again,

try sam

SAM Areas:Performance Monitors -> System Properties

and go to the Memory tab to get the details as in below:


e.g.

Physical Memory: 8199.3 MB
Real Memory:
Active: 178900.2 KB
Total: 436055.3 KB
Virtual Memory:
Active: 933137.9 KB
Total: 1272954.1 KB
Free Memory Pages: 1689926 at 4 KB/page
Swap Space:
Avail: 10240 MB
Used: 477 MB



hope this helps!
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Don Morris_1
Honored Contributor

Re: How to see total memory usage..

If you're saying that swapinfo only shows device, Filesystem, reserve and total lines it sounds like this server doesn't have swapmem_on set.
Arun Jain
Frequent Advisor

Re: How to see total memory usage..

Hi Don Morris,

yes, you are right, "swapmem_on" parameter is not set. But for that I have to restart the server which I can't do.

Regards:
Arun
speak less say more
Arun Jain
Frequent Advisor

Re: How to see total memory usage..

Hi yogeeraj,

this one also cant solve the problem as it gives absolute data, but I want the same data in percentage.

Regards:
Arun
speak less say more
Yogeeraj_1
Honored Contributor

Re: How to see total memory usage..

hi again,

have a look at the following URL:
ftp://hprc.external.hp.com/memory.htm#kmeminfo


kmeminfo utility displays the information in the format below:

# ./kmeminfo
tool: kmeminfo 7.02
unix: /stand/vmunix 11.11 64bit PA2.0 on "my.box.com"
core: /dev/kmem live
link: Wed Feb 1 07:45:48 PST 2006
boot: Sat Apr 28 17:36:56 2007
time: Thu May 3 08:37:33 2007
nbpg: 4096 bytes


----------------------------------------------------------------------
Physical memory usage summary (in page/byte/percent):

Physical memory = 5242880 20.0g 100%
Free memory = 537474 2.1g 10%
User processes = 4008776 15.3g 76% details with -user
System = 683688 2.6g 13%
Kernel = 421544 1.6g 8% kernel text and data
Dynamic Arenas = 96880 378.4m 2% details with -arena
M_TEMP = 43860 171.3m 1%
VFD_BT_NODE = 15210 59.4m 0%
M_SPINLOCK = 7245 28.3m 0%
KMEM_ALLOC = 5432 21.2m 0%
ALLOCB_MBLK_LM = 2813 11.0m 0%
Other arenas = 22320 87.2m 0% details with -arena
Super page pool = 7021 27.4m 0% details with -kas
Static Tables = 263990 1.0g 5% details with -static
pfdat = 119481 466.7m 2%
htbl2_0 = 65536 256.0m 1%
nbuf = 21024 82.1m 0% bufcache headers
bufhash = 20480 80.0m 0% bufcache hash headers
pfn_to_virt = 19913 77.8m 0%
Other tables = 17555 68.6m 0% details with -static
Buffer cache = 262144 1.0g 5% details with -bufcache
UFC file mrg = 0 0.0b 0%
UFC meta mrg = 0 0.0b 0%
#


kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Yogeeraj_1
Honored Contributor

Re: How to see total memory usage..

hi again,

am attaching the utility which you can install and run to get the output as below:

SRV2:tmp>sh 267829.bin
Running install script : ./kmeminfo.install kmeminfo a 1
SRV2:tmp>kmeminfo
sh: kmeminfo: not found.
SRV2:tmp>./kmeminfo
Kernel TEXT pages not requested in crashconf
Will use an artificial mapping from a.out TEXT pages
kmeminfo (4.17)
unix: /stand/vmunix 11.11 64bit PA2.0
core: /dev/kmem live
link: Fri Oct 5 16:17:34 MRU 2007
boot: Tue Feb 19 09:28:50 2008
dump: Wed Mar 19 15:22:03 2008

----------------------------------------------------------------------
Pfdat processing:

Scanning 2042349 pfdat entries (be patient) ...


----------------------------------------------------------------------
Physical memory usage summary (in page/byte/percent):

Physmem = 2097152 8.0g 100% Physical memory
Freemem = 1688740 6.4g 81% Free physical memory
Used = 408412 1.6g 19% Used physical memory
System = 295412 1.1g 14% By kernel:
text = 2542 9.9m 0% text
data = 477 1.9m 0% data
bss = 1152 4.5m 0% bss
Static = 102869 401.8m 5% for text/static data
Dynamic = 83461 326.0m 4% for dynamic data
Bufcache = 104857 409.6m 5% for buffer cache
Eqmem = 47 188.0k 0% for equiv. mapped memory
SCmem = 4178 16.3m 0% for critical memory
User = 117176 457.7m 6% By user processes:
Uarea = 4976 19.4m 0% for thread uareas
Disowned = 8 32.0k 0% Disowned pages

----------------------------------------------------------------------
Kernel dynamic memory usage (in page/byte/percent):

Physmem = 2097152 8.0g 100% Physical memory
Freemem = 1688740 6.4g 81% Free memory
Used = 408412 1.6g 19% Used memory
Dynamic = 83461 326.0m 4% Kernel dynamic memory
Arenas = 63646 248.6m 3% Kernel arenas
M_TEMP = 40576 158.5m 2%
M_SWAP = 5344 20.9m 0%
M_SPINLOCK = 3928 15.3m 0%
M_NFS_GEN = 1707 6.7m 0%
ALLOCB_MBLK_LM = 1498 5.9m 0%
KMEM_ALLOC = 1413 5.5m 0%
M_VXVM = 1368 5.3m 0%
ALLOCB_MBLK_DA = 776 3.0m 0%
M_KTHREAD = 637 2.5m 0%
M_REG = 629 2.5m 0%
VFD_BT_NODE = 577 2.3m 0%
M_PREG = 573 2.2m 0%
M_IOSYS = 568 2.2m 0%
VM MISC ARENA = 517 2.0m 0%
ALLOCB_MBLK_SM = 329 1.3m 0%
Other = 3206 12.5m 0% Other arenas...
Kalloc = 19781 77.3m 1% kalloc()
SuperPagePool = 5016 19.6m 0% Kernel superpage cache
BufcacheBufs = 8304 32.4m 0% Buffer cache bufs
BufcacheHash = 5120 20.0m 0% Buffer cache hash heads
Other = 1341 5.2m 0% Other...
Eqalloc = 34 136.0k 0% eqalloc()
SRV2:tmp>


hope this helps!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Yogeeraj_1
Honored Contributor

Re: How to see total memory usage..

attachment
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Fabio Ettore
Honored Contributor

Re: How to see total memory usage..

Hi Arun,

Don is right. You cannot see the line memory in swapinfo -tam because of swapmem_on is not set to 1 on kernel.
Unfortunately you have to reboot the system to enable that when changing swapmem_on to 1.
Also pay attention that line "memory" in swapinfo output is not the "main memory", this is a (explainable) common mistake.
From man swapinfo:

memory Memory paging area (also known as pseudo-swap).
This is the amount of system memory that can be
used to hold pages in the event that all of the
above paging areas are used up. See "Paging
Allocation" below. This line appears only if
memory paging is enabled.

Best regards,
Fabio
WISH? IMPROVEMENT!
Hein van den Heuvel
Honored Contributor

Re: How to see total memory usage..

>> this one also cant solve the problem as it gives absolute data, but I want the same data in percentage.

74% of the responses to your posts have not been assigned points.

Grins,
Hein. (0 points for this please)
Don Morris_1
Honored Contributor

Re: How to see total memory usage..

kmeminfo here verges on using a sledgehammer to swat a fly (and opens up a lot of questions on things you can't do anything about anyway, like why a particular kernel arena is using a certain amount of memory). Plus you have to be confident that you're using an appropriate version of kmeminfo, have sufficient privilege to read kernel memory, etc.

Far simpler (and sorry I didn't post this in the first place -- but your original phrasing was very unclear that you weren't just asking about swapinfo itself) to use the supported pstat() interfaces.

Attached is memdetail.c -- which I did not write (its been posted before, and it is very good at what it does). I think it does basically what you've asked for... if you want more detailed information, there's likely other pstat based programs folks have posted.

# cc +DD32 -D_PSTAT64 -o memdetail memdetail.c
"memdetail.c", line 122: warning #2117-D: non-void function "main" should
return a value
return;
^

# ./memdetail
Memory Stat total used avail %used
physical 4743.2 1633.0 3110.2 34%
active virtual 578.1 371.6 206.5 64%
active real 348.1 199.7 148.4 57%
memory swap 4518.2 1048.1 3470.1 23%
device swap 32768.0 411.8 32356.2 1%
Dennis Handly
Acclaimed Contributor

Re: How to see total memory usage

>I have 8 Gb main memory and 9 GB (4+5) memory in swap, 17 Gb in total.

Since you don't have swapmem_on set, you only have 9 Gb total.

>Don: warning #2117-D: non-void function "main" should return a value

Any reason you didn't "improve" this when you reposted? ;-) Then you wouldn't have to explain the warning.
Change to: return 0;

Yogeeraj_1
Honored Contributor

Re: How to see total memory usage..

thank you Don and Dennis

Uploading the modified version of memdetail

SRV2:home/yogeeraj>cc +DD32 -D_PSTAT64 -o memdetail memdetail.c
SRV2:home/yogeeraj>./memdetail
Memory Stat total used avail %used
physical 8192.0 1587.5 6604.5 19%
active virtual 1229.7 875.3 354.4 71%
active real 416.1 150.6 265.5 36%
memory swap 6309.9 351.3 5958.6 6%
device swap 10240.0 465.8 9774.2 5%
SRV2:home/yogeeraj>

hope this helps!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Yogeeraj_1
Honored Contributor

Re: How to see total memory usage..

attachment.

nb. replaced
main()
with
void main(void)
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Dennis Handly
Acclaimed Contributor

Re: How to see total memory usage

>Yogeeraj: replaced main() with: void main(void)

Ack!! That is illegal. The C and C++ Standards require it to be:
int main. (void) isn't needed for definitions.

Only C89 requires a "return 0;" at the end, the others default to it.

Yogeeraj_1
Honored Contributor

Re: How to see total memory usage..

Dennis> Ack!! That is illegal. The C and C++ Standards require it to be: int main. (void) isn't needed for definitions.

Sorry i was not aware of this. thank you for this clarification. I really appreciate.

Source updated and attached herein.

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)