diff options
author | rwatson <rwatson@FreeBSD.org> | 2005-12-08 13:33:12 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2005-12-08 13:33:12 +0000 |
commit | cb090e138663a54857f723eccef8f149d3c0732b (patch) | |
tree | 6a8da4473b16b33fba3c9d7f23de954efc2351a6 /tools | |
parent | 0485d4dec3d08cda5036841b16d4c0df01504fc5 (diff) | |
download | FreeBSD-src-cb090e138663a54857f723eccef8f149d3c0732b.zip FreeBSD-src-cb090e138663a54857f723eccef8f149d3c0732b.tar.gz |
After printing per-cpu cache contents, summarize total cached items and
entries across the caches.
Fix an off-by-one error in counting caches.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/umastat/umastat.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/tools/tools/umastat/umastat.c b/tools/tools/umastat/umastat.c index f676a78..fb0cdde 100644 --- a/tools/tools/umastat/umastat.c +++ b/tools/tools/umastat/umastat.c @@ -235,7 +235,7 @@ uma_print_bucketlist(kvm_t *kvm, struct bucketlist *bucketlist, static void uma_print_cache(kvm_t *kvm, struct uma_cache *cache, const char *name, - int cpu, const char *spaces) + int cpu, const char *spaces, int *ub_cnt_add, int *ub_entries_add) { struct uma_bucket ub; int ret; @@ -251,6 +251,10 @@ uma_print_cache(kvm_t *kvm, struct uma_cache *cache, const char *name, printf("%s uc_freebucket ", spaces); uma_print_bucket(&ub, spaces); printf(";\n"); + if (ub_cnt_add != NULL) + *ub_cnt_add += ub.ub_cnt; + if (ub_entries_add != NULL) + *ub_entries_add += ub.ub_entries; } else printf("%s uc_freebucket = NULL;\n", spaces); if (cache->uc_allocbucket != NULL) { @@ -260,6 +264,10 @@ uma_print_cache(kvm_t *kvm, struct uma_cache *cache, const char *name, printf("%s uc_allocbucket ", spaces); uma_print_bucket(&ub, spaces); printf(";\n"); + if (ub_cnt_add != NULL) + *ub_cnt_add += ub.ub_cnt; + if (ub_entries_add != NULL) + *ub_entries_add += ub.ub_entries; } else printf("%s uc_allocbucket = NULL;\n", spaces); printf("%s};\n", spaces); @@ -273,7 +281,7 @@ main(int argc, char *argv[]) struct uma_keg *kzp, kz; struct uma_zone *uzp, *uzp_userspace; kvm_t *kvm; - int all_cpus, cpu, mp_maxcpus, mp_maxid, ret; + int all_cpus, cpu, mp_maxcpus, mp_maxid, ret, ub_cnt, ub_entries; size_t uzp_userspace_len; if (argc != 1) @@ -401,14 +409,18 @@ main(int argc, char *argv[]) " "); if (!(kz.uk_flags & UMA_ZFLAG_INTERNAL)) { - for (cpu = 0; cpu < mp_maxid; cpu++) { + ub_cnt = ub_entries = 0; + for (cpu = 0; cpu <= mp_maxid; cpu++) { /* if (CPU_ABSENT(cpu)) */ if ((all_cpus & (1 << cpu)) == 0) continue; uma_print_cache(kvm, &uzp_userspace->uz_cpu[cpu], - "uc_cache", cpu, " "); + "uc_cache", cpu, " ", &ub_cnt, + &ub_entries); } + printf(" // %d cache total cnt, %d total " + "entries\n", ub_cnt, ub_entries); } printf(" };\n"); |