memory utilization questions
David Wolfskill
david at catwhisker.org
Wed Aug 6 12:38:14 UTC 2014
On Wed, Aug 06, 2014 at 02:53:14PM +0300, Stefan Parvu wrote:
>
> Im planning to calculate real used, free memory. Can anyone confirm if these
> are correct:
>
> 1. real used memory
>
> usedmem = totalmem - freemem,
>
> totalmem = vm.stats.vm.v_page_count x page_size
> freemem = vm.stats.vm.v_free_count x page_size
>
>
> 2. real free memory
>
> realfree = inactive + cache + free ?
>
> inactive = vm.stats.vm.v_inactive_count x page_size
> cache = vm.stats.vm.v_cache_count x page_size
> free = vm.stats.vm.v_free_count x page_size
> ...
In what I have:
* I assume(!) that page size is invariant during any interval I care
about.
* I do the calulations in KB (1024B), so I get the hw.pagesize OID &
integer-divide that by 1024 to get a page_to_kb factor (e.g., for 4K
pagesize, the factor is 4).
* Other OIDs: vm.stats.vm.v_active_count, vm.stats.vm.v_inactive_count,
vm.stats.vm.v_wire_count, vm.stats.vm.v_cache_count,
vm.stats.vm.v_free_count; I multiply each of these by the "page_to_kb
factor" determined above (to get results in KB).
* Another OID: vfs.bufspace; I integer-divide this by 1024 (to get
results in KB), as it seems to be in bytes vs. pages.
* Correspondence between names as used by top(1) vs. OID:
Active: vm.stats.vm.v_active_count
Inact: vm.stats.vm.v_inactive_count
Wired: vm.stats.vm.v_wire_count
Cache: vm.stats.vm.v_cache_count
Buf: vfs.bufspace
Free: vm.stats.vm.v_free_count
Peace,
david
--
David H. Wolfskill david at catwhisker.org
Taliban: Evil cowards with guns afraid of truth from a 14-year old girl.
See http://www.catwhisker.org/~david/publickey.gpg for my public key.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 949 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20140806/8269c28c/attachment.sig>
More information about the freebsd-hackers
mailing list