diff options
author | Robert Watson <rwatson@FreeBSD.org> | 2005-07-14 16:17:21 +0000 |
---|---|---|
committer | Robert Watson <rwatson@FreeBSD.org> | 2005-07-14 16:17:21 +0000 |
commit | 773df9ab1650368f1c5a4587303d6a6b812e860b (patch) | |
tree | 35187bf6145198fd6ece5eecfb6230809004aaaf /sys/vm | |
parent | 2c743d361a086a24991e135ca9becaf51a3c066d (diff) | |
download | src-773df9ab1650368f1c5a4587303d6a6b812e860b.tar.gz src-773df9ab1650368f1c5a4587303d6a6b812e860b.zip |
In addition to tracking allocs in the zone, also track frees. Add
a zone free counter, as well as a cache free counter.
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=147995
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/uma_core.c | 5 | ||||
-rw-r--r-- | sys/vm/uma_int.h | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 630b80b07d3e..7f82a435eae1 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -1325,6 +1325,7 @@ zone_ctor(void *mem, int size, void *udata, int flags) zone->uz_init = NULL; zone->uz_fini = NULL; zone->uz_allocs = 0; + zone->uz_frees = 0; zone->uz_fills = zone->uz_count = 0; if (arg->flags & UMA_ZONE_SECONDARY) { @@ -1894,6 +1895,8 @@ zalloc_start: /* Since we have locked the zone we may as well send back our stats */ zone->uz_allocs += cache->uc_allocs; cache->uc_allocs = 0; + zone->uz_frees += cache->uc_frees; + cache->uc_frees = 0; /* Our old one is now a free bucket */ if (cache->uc_allocbucket) { @@ -2296,6 +2299,7 @@ zfree_start: ("uma_zfree: Freeing to non free bucket index.")); bucket->ub_bucket[bucket->ub_cnt] = item; bucket->ub_cnt++; + cache->uc_frees++; critical_exit(); return; } else if (cache->uc_allocbucket) { @@ -2467,6 +2471,7 @@ uma_zfree_internal(uma_zone_t zone, void *item, void *udata, /* Zone statistics */ keg->uk_free++; + zone->uz_frees++; if (keg->uk_flags & UMA_ZFLAG_FULL) { if (keg->uk_pages < keg->uk_maxpages) diff --git a/sys/vm/uma_int.h b/sys/vm/uma_int.h index 2fcc15aef0ed..365aa9078c33 100644 --- a/sys/vm/uma_int.h +++ b/sys/vm/uma_int.h @@ -177,6 +177,7 @@ struct uma_cache { uma_bucket_t uc_freebucket; /* Bucket we're freeing to */ uma_bucket_t uc_allocbucket; /* Bucket to allocate from */ u_int64_t uc_allocs; /* Count of allocations */ + u_int64_t uc_frees; /* Count of frees */ }; typedef struct uma_cache * uma_cache_t; @@ -303,6 +304,7 @@ struct uma_zone { uma_fini uz_fini; /* Discards memory */ u_int64_t uz_allocs; /* Total number of allocations */ + u_int64_t uz_frees; /* total number of frees */ uint16_t uz_fills; /* Outstanding bucket fills */ uint16_t uz_count; /* Highest value ub_ptr can have */ |