Date: Tue, 20 Mar 2001 11:05:54 -0600 (CST) From: David Scheidt <dscheidt@tumbolia.com> To: sean-freebsd-hackers@chittenden.org Cc: freebsd-hackers@freebsd.org Subject: Re: Easy way to compute memory stats? (procfs?) Message-ID: <Pine.BSF.4.21.0103201050380.95916-100000@shell-2.enteract.com> In-Reply-To: <20010319223303.K84536@rand.tgd.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 19 Mar 2001 sean-freebsd-hackers@chittenden.org wrote: :> : Is there an easy way (from script ideally) to get the following :> :stats: :> : :> :free physical mem (avail ram) :> :> has a reasonable uptime. The VM system will cache things unless :> there's a demand for memory. vm.stats.vm.v_free_count has the value : : Drat. I was hoping to arrive at a number similar to top's :Free column. Right now the vm stat from sysctl is about 25% of what :top's reporting (256MB physical). At the same time... the free pages :may be a good value for me to toss around given that I'm also :including the load and some statistics of the host's past. The sysctl MIB vm.stats.vm.v_free_count has the same value as top's Free Column. (In pages) It's just not a very useful number. The machine I'm sitting at has 213 pages free, but it's not in any danger of running out of memory. The only times there will be lots of free memory are at system startup, when the memory has never been used, and if a large process exits, freeing its memory. (Quiting Netscape brought my free pages to 13139) : :> :free swap :> :> pstat(8) will tell you this : : Duh, thanks. : :> :total avail mem :> :> Do you mean physical memory, in which case the value of hw.physmem will :> tellyou. : : Phys mem + swap, which I think I can calc pretty easily now :that I have swap. -sc Well, not all memory is swapable, nor is all memory swap backed. Exectuable text sections are backed by the disk file, as it's much faster to just throw them away, reading them from disk if they're needed again, then it is to write them to swap and read them back from there. The same thing is true of files that have been mmaped -- the memory used is backed by the disk file, not swap. The available memory is higher than physical memory + swap. The usable memory is often less than physical memory + swap, as well. This box has 256MB RAM, and 756MB swap. Most of the time, if swap is being touched at all, there's something broken, and the machine is not very useable. However, if I've got something like a huge Netscape process, that's idle, and then start working with something else that uses masses of memory, the idle Netscape can get swapped out, and have 150MB of swapped used, and a box that is its normal zippy self. -- dscheidt@tumbolia.com Bipedalism is only a fad. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0103201050380.95916-100000>