* Generate statistics across both the zone and its per-cpu cache's. Return * desired statistics if the pointer is non-NULL for that statistic. * * Note: does not update the zone statistics, as it can't safely clear the * per-CPU cache statistic. * */
| 5084 | * |
| 5085 | */ |
| 5086 | static void |
| 5087 | uma_zone_sumstat(uma_zone_t z, long *cachefreep, uint64_t *allocsp, |
| 5088 | uint64_t *freesp, uint64_t *sleepsp, uint64_t *xdomainp) |
| 5089 | { |
| 5090 | uma_cache_t cache; |
| 5091 | uint64_t allocs, frees, sleeps, xdomain; |
| 5092 | int cachefree, cpu; |
| 5093 | |
| 5094 | allocs = frees = sleeps = xdomain = 0; |
| 5095 | cachefree = 0; |
| 5096 | CPU_FOREACH(cpu) { |
| 5097 | cache = &z->uz_cpu[cpu]; |
| 5098 | cachefree += cache->uc_allocbucket.ucb_cnt; |
| 5099 | cachefree += cache->uc_freebucket.ucb_cnt; |
| 5100 | xdomain += cache->uc_crossbucket.ucb_cnt; |
| 5101 | cachefree += cache->uc_crossbucket.ucb_cnt; |
| 5102 | allocs += cache->uc_allocs; |
| 5103 | frees += cache->uc_frees; |
| 5104 | } |
| 5105 | allocs += counter_u64_fetch(z->uz_allocs); |
| 5106 | frees += counter_u64_fetch(z->uz_frees); |
| 5107 | xdomain += counter_u64_fetch(z->uz_xdomain); |
| 5108 | sleeps += z->uz_sleeps; |
| 5109 | if (cachefreep != NULL) |
| 5110 | *cachefreep = cachefree; |
| 5111 | if (allocsp != NULL) |
| 5112 | *allocsp = allocs; |
| 5113 | if (freesp != NULL) |
| 5114 | *freesp = frees; |
| 5115 | if (sleepsp != NULL) |
| 5116 | *sleepsp = sleeps; |
| 5117 | if (xdomainp != NULL) |
| 5118 | *xdomainp = xdomain; |
| 5119 | } |
| 5120 | #endif /* DDB */ |
| 5121 | |
| 5122 | static int |
no test coverage detected