Operating System - HP-UX
1752586 Members
4174 Online
108788 Solutions
New Discussion юеВ

Re: How to see total memory usage..

 
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)