Date: Wed, 6 Aug 2014 05:38:11 -0700 From: David Wolfskill <david@catwhisker.org> To: Stefan Parvu <sparvu@systemdatarecorder.org> Cc: freebsd-hackers@freebsd.org Subject: Re: memory utilization questions Message-ID: <20140806123811.GB1228@albert.catwhisker.org> In-Reply-To: <20140806145314.643dcc34a360f8284083930e@systemdatarecorder.org> References: <20140806145314.643dcc34a360f8284083930e@systemdatarecorder.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--w8QetmdSDwT395M8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 06, 2014 at 02:53:14PM +0300, Stefan Parvu wrote: >=20 > Im planning to calculate real used, free memory. Can anyone confirm if th= ese > are correct: >=20 > 1. real used memory >=20 > usedmem =3D totalmem - freemem, >=20 > totalmem =3D vm.stats.vm.v_page_count x page_size > freemem =3D vm.stats.vm.v_free_count x page_size >=20 >=20 > 2. real free memory >=20 > realfree =3D inactive + cache + free ? >=20 > inactive =3D vm.stats.vm.v_inactive_count x page_size > cache =3D vm.stats.vm.v_cache_count x page_size > free =3D 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 --=20 David H. Wolfskill david@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. --w8QetmdSDwT395M8 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQJ8BAEBCgBmBQJT4iGyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ4RThEMDY4QTIxMjc1MDZFRDIzODYzRTc4 QTY3RjlDOERFRjQxOTNCAAoJEIpn+cje9Bk7gTcQAISqsRdBbeUlTRSSTQxkOIjc ZriNv0WQcGez8bh2S1BL492zCPs+bJn19hCaPbFTwR3GLJJE0PKLl1nC9cXgc3pg ofkeKfcvsxg+UKMSmwi5gaza7wPtpQkSwHrSERBttLueu73fEVRSiecJNKFs/ka+ cefmHNXDfgepaLWgvM62XkBSy9rJfKakyxBaIabkJZ+s63g8RbbKtvpOv9T3x8GB RHIPPFsZjelINe1lNQQ6GT6LSW73Kp+0igoHTyifBN7G+LeAwycF3nAU6LewnH+K GnitAE10SFzKZtRG6M8N7nIT0UKI60jIHKw4DkWWTwXIDPdNIZLxTrih/CYyGePH WWrji/twlNLolKlJSyDyKlJdRhXRAKtZY4/WEwGQAdvOxTkEoyqFDTD4Kv8UH7wL +FiY+tBBjUIk7M23IQwKjXv06uXDmZtDh67c67v1b/FbM4PD/nXi3QzanjaPFjiq d6iqQKK3Tm4abTE9tPdNgY1QnN2li883m2Ok7g7PYZsFKMk2IwCj+YaC1oK27HL5 4ofkHb5CbZKaDmhZ+buGmDhh8yIRug8FmEsZJ3l24S4NkT3lcGdE1xJu7HKrDpQZ UfIhj0WLyrLURVLVISnahQesTzIhsE1xC88gJwbNiP2tUpL4GtmpRCN7FyuHL87w eXK3enzdUtNI93WBJNnx =zp6l -----END PGP SIGNATURE----- --w8QetmdSDwT395M8--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140806123811.GB1228>