diff options
author | dyson <dyson@FreeBSD.org> | 1997-08-07 03:52:55 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1997-08-07 03:52:55 +0000 |
commit | 85f902e519afa7dd7e3c1b375e69d01c672307e4 (patch) | |
tree | e30bb51cc6fc98040663ab1c90dcb73dc78bc90a /sys/vm | |
parent | f4c7456c09a561d31c5a32bd092bee2674b6f69c (diff) | |
download | FreeBSD-src-85f902e519afa7dd7e3c1b375e69d01c672307e4.zip FreeBSD-src-85f902e519afa7dd7e3c1b375e69d01c672307e4.tar.gz |
More vm_zone cleanup. The sysctl now accounts for items better, and
counts the number of allocations.
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_zone.c | 16 | ||||
-rw-r--r-- | sys/vm/vm_zone.h | 4 |
2 files changed, 15 insertions, 5 deletions
diff --git a/sys/vm/vm_zone.c b/sys/vm/vm_zone.c index 4abb36d..cc71421 100644 --- a/sys/vm/vm_zone.c +++ b/sys/vm/vm_zone.c @@ -18,7 +18,7 @@ * 5. Modifications may be freely made to this file if the above conditions * are met. * - * $Id: vm_zone.c,v 1.2 1997/08/05 22:24:30 dyson Exp $ + * $Id: vm_zone.c,v 1.3 1997/08/06 04:58:04 dyson Exp $ */ #include <sys/param.h> @@ -92,6 +92,7 @@ zinitna(vm_zone_t z, vm_object_t obj, char *name, int size, z->ztotal = 0; z->zmax = 0; z->zname = name; + z->znalloc = 0; if (zlist == 0) { zlist = z; @@ -186,6 +187,7 @@ zbootinit(vm_zone_t z, char *name, int size, void *item, int nitems) { z->zallocflag = 0; z->zpagecount = 0; z->zalloc = 0; + z->znalloc = 0; simple_lock_init(&z->zlock); for (i = 0; i < nitems; i++) { @@ -321,7 +323,7 @@ sysctl_vm_zone SYSCTL_HANDLER_ARGS int error=0; vm_zone_t curzone, nextzone; char tmpbuf[128]; - char tmpname[16]; + char tmpname[14]; for (curzone = zlist; curzone; curzone = nextzone) { int i; @@ -329,18 +331,24 @@ sysctl_vm_zone SYSCTL_HANDLER_ARGS int offset; nextzone = curzone->znext; len = strlen(curzone->zname); + if (len >= (sizeof(tmpname) - 1)) + len = (sizeof(tmpname) - 1); for(i = 0; i < sizeof(tmpname) - 1; i++) tmpname[i] = ' '; tmpname[i] = 0; memcpy(tmpname, curzone->zname, len); + tmpname[len] = ':'; offset = 0; if (curzone == zlist) { offset = 1; tmpbuf[0] = '\n'; } - sprintf(tmpbuf + offset, "%s: maxpossible=%6.6d, total=%6.6d, free=%6.6d\n", - tmpname, curzone->zmax, curzone->ztotal, curzone->zfreecnt); + sprintf(tmpbuf + offset, + "%s limit=%8.8u, used=%6.6u, free=%6.6u, requests=%8.8u\n", + tmpname, curzone->zmax, + (curzone->ztotal - curzone->zfreecnt), + curzone->zfreecnt, curzone->znalloc); len = strlen((char *)tmpbuf); if (nextzone == NULL) { diff --git a/sys/vm/vm_zone.h b/sys/vm/vm_zone.h index 39abfa1..05aab2d 100644 --- a/sys/vm/vm_zone.h +++ b/sys/vm/vm_zone.h @@ -19,7 +19,7 @@ * 5. Modifications may be freely made to this file if the above conditions * are met. * - * $Id: vm_zone.h,v 1.2 1997/08/05 22:24:31 dyson Exp $ + * $Id: vm_zone.h,v 1.3 1997/08/06 04:58:05 dyson Exp $ */ #if !defined(_SYS_ZONE_H) @@ -38,6 +38,7 @@ typedef struct vm_zone { void *zitems; /* linked list of items */ int zfreecnt; /* free entries */ int zfreemin; /* minimum number of free entries */ + int znalloc; /* number of allocations */ vm_offset_t zkva; /* Base kva of zone */ int zpagecount; /* Total # of allocated pages */ int zpagemax; /* Max address space */ @@ -81,6 +82,7 @@ _zalloc(vm_zone_t z) { item = z->zitems; z->zitems = *(void **) item; z->zfreecnt--; + z->znalloc++; return item; } |