showing total/free memory

Chris Pressey cpressey at catseye.mine.nu
Thu Jan 29 13:40:03 PST 2004


On Thu, 29 Jan 2004 21:29:07 +0000
Jez Hancock <jez.hancock at munk.nu> wrote:

> On Fri, Jan 30, 2004 at 08:11:26AM +1100, Rowdy wrote:
> > Chris Pressey wrote:
> > 
> > >Well, I'm not sure if it works on 5.x, but you could try
> > >
> > >  /usr/ports/sysutils/muse
> > >
> > >Should be easier to parse than the other options.
> > >
> > >-Chris
> You could always output the results of dmesg at boot-time to a file -
> adding something like this:
> 
> dmesg > /var/log/dmesg.boot
> 
> to /usr/local/etc/rc.local.

This already happens, to /var/run/dmesg.boot

Not sure how to account for the discrepancy - presumably it's not
counting memory that can't be used under FreeBSD (possibly the 'wired'
memory, for the kernel, and some other stuff.)  If you really need the
real total memory on the machine (as opposed to what's available to the
operating system,) you should probably parse /var/run/dmesg.boot (which
isn't difficult - just grep for 'real memory' and take the fourth field
with e.g. awk '{ print $4 }'.)

-Chris


More information about the freebsd-questions mailing list