Subject: Re: HEADS UP: UBC code integrated
To: Matthias Scheler <tron@zhadum.de>
From: Simon Burge <simonb@wasabisystems.com>
List: current-users
Date: 11/30/2000 19:49:01
Matthias Scheler wrote:

> In article <20001127011834.A11840@spathi.chuq.com>,
> 	Chuck Silvers <chuq@chuq.com> writes:
> > the Unified Buffer Cache project that I've been working on pretty much
> > forever has finally been integrated into -current.
> 
> Great. Is there a userland program to see how well it works? I can e.g.
> use "free" under Linux:
> 
> tron@gaia:~>free
>              total       used       free     shared    buffers     cached
> Mem:         63228      62544        684       5256       7104      12100
> -/+ buffers/cache:      43340      19888
> Swap:       130748      36692      94056

Most of this info is (or will be) available in vmstat -s.  I'm not sure
how some of those fields map to what NetBSD uses, but here's the output
of a quick script:

	alpha:netbsd/projects/free 83> ./free.sh 
		     total       used       free    buffers
	Mem:        122368      43280      79088      11712
	Swap:      2097640    2091608       6032
	alpha:netbsd/projects/free 84> cat /local/0/BACKUP.tar.gz > /dev/null
	alpha:netbsd/projects/free 84> ./free.sh 
		     total       used       free    buffers
	Mem:        122368      77928      44440      46360
	Swap:      2097640    2091608       6032

BACKUP.tar.gz is a 35ish MB file.

Here's the script - note that I haven't committed the "vnode data pages"
part of vmstat yet!

#!/bin/sh

vmstat -s | awk '
/ bytes per page$/ { bpp = $1 }
/ pages managed$/ { totalmem = $1 }
/ pages free$/ { free = $1 }
/ vnode data pages$/ { vbuffer = $1 }
/ swap pages$/ { totalswap = $1 }
/ swap pages in use$/ { swapused = $1 }
END {
	printf("%18s %10s %10s %10s\n", "total", "used", "free", "buffers");

	printf("Mem:    %10d %10d %10d %10d\n", totalmem * bpp / 1024,
	    (totalmem - free) * bpp / 1024, free * bpp / 1024,
	    vbuffer * bpp / 1024);
	
	printf("Swap:   %10d %10d %10d\n", totalswap * bpp / 1024,
	    (totalswap - swapused) * bpp / 1024, swapused * bpp / 1024);
}'


Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD Sales, Support and Service:  http://www.wasabisystems.com/