Date: Thu, 20 Oct 2005 17:28:00 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 85601 for review Message-ID: <200510201728.j9KHS0gu015917@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=85601 Change 85601 by rwatson@rwatson_zoo on 2005/10/20 17:27:15 Add DDB "show uma" command. Affected files ... .. //depot/projects/trustedbsd/audit3/sys/vm/uma_core.c#6 edit Differences ... ==== //depot/projects/trustedbsd/audit3/sys/vm/uma_core.c#6 (text+ko) ==== @@ -57,7 +57,9 @@ #define UMA_DEBUG_ALLOC_1 1 */ +#include "opt_ddb.h" #include "opt_param.h" + #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> @@ -86,6 +88,8 @@ #include <machine/vmparam.h> +#include <ddb/ddb.h> + /* * This is the zone and keg from which all zones are spawned. The idea is that * even the zone & keg heads are allocated from the allocator, so we use the @@ -3039,3 +3043,35 @@ free(buffer, M_TEMP); return (error); } + +#ifdef DDB +DB_SHOW_COMMAND(uma, db_show_uma) +{ + u_int64_t allocs, frees; + uma_bucket_t bucket; + uma_keg_t kz; + uma_zone_t z; + int cachefree; + + db_printf("%18s %12s %12s %12s %8s\n", "Zone", "Allocs", "Frees", + "Used", "Cache"); + LIST_FOREACH(kz, &uma_kegs, uk_link) { + LIST_FOREACH(z, &kz->uk_zones, uz_link) { + if (kz->uk_flags & UMA_ZFLAG_INTERNAL) { + allocs = z->uz_allocs; + frees = z->uz_frees; + cachefree = 0; + } else + uma_zone_sumstat(z, &cachefree, &allocs, + &frees); + if (!((kz->uk_flags & UMA_ZONE_SECONDARY) && + (LIST_FIRST(&kz->uk_zones) != z))) + cachefree += kz->uk_free; + LIST_FOREACH(bucket, &z->uz_full_bucket, ub_link) + cachefree += bucket->ub_cnt; + db_printf("%18s %12llu %12llu %12llu %8d\n", z->uz_name, + allocs, frees, allocs - frees, cachefree); + } + } +} +#endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510201728.j9KHS0gu015917>