View | Details | Raw Unified | Return to bug 146119
Collapse All | Expand All

(-)tools/tools/umastat/umastat.c (-11 / +13 lines)
Lines 37-42 Link Here
37
37
38
#include <err.h>
38
#include <err.h>
39
#include <kvm.h>
39
#include <kvm.h>
40
#include <limits.h>
40
#include <memstat.h>
41
#include <memstat.h>
41
#include <stdio.h>
42
#include <stdio.h>
42
#include <stdlib.h>
43
#include <stdlib.h>
Lines 196-202 Link Here
196
LIST_HEAD(bucketlist, uma_bucket);
197
LIST_HEAD(bucketlist, uma_bucket);
197
198
198
static void
199
static void
199
uma_print_bucket(struct uma_bucket *ubp, const char *spaces)
200
uma_print_bucket(struct uma_bucket *ubp, const char *spaces __unused)
200
{
201
{
201
202
202
	printf("{ ub_cnt = %d, ub_entries = %d }", ubp->ub_cnt,
203
	printf("{ ub_cnt = %d, ub_entries = %d }", ubp->ub_cnt,
Lines 230-236 Link Here
230
	}
231
	}
231
232
232
	printf("\n");
233
	printf("\n");
233
	printf("%s};  // total cnt %llu, total entries %llu\n", spaces,
234
	printf("%s};  // total cnt %ju, total entries %ju\n", spaces,
234
	    total_cnt, total_entries);
235
	    total_cnt, total_entries);
235
}
236
}
236
237
Lines 242-249 Link Here
242
	int ret;
243
	int ret;
243
244
244
	printf("%s%s[%d] = {\n", spaces, name, cpu);
245
	printf("%s%s[%d] = {\n", spaces, name, cpu);
245
	printf("%s  uc_frees = %llu;\n", spaces, cache->uc_frees);
246
	printf("%s  uc_frees = %ju;\n", spaces, cache->uc_frees);
246
	printf("%s  uc_allocs = %llu;\n", spaces, cache->uc_allocs);
247
	printf("%s  uc_allocs = %ju;\n", spaces, cache->uc_allocs);
247
248
248
	if (cache->uc_freebucket != NULL) {
249
	if (cache->uc_freebucket != NULL) {
249
		ret = kread(kvm, cache->uc_freebucket, &ub, sizeof(ub), 0);
250
		ret = kread(kvm, cache->uc_freebucket, &ub, sizeof(ub), 0);
Lines 286-291 Link Here
286
	size_t uzp_userspace_len;
287
	size_t uzp_userspace_len;
287
	char *memf, *nlistf;
288
	char *memf, *nlistf;
288
	int ch;
289
	int ch;
290
	char errbuf[_POSIX2_LINE_MAX];
289
291
290
	memf = nlistf = NULL;
292
	memf = nlistf = NULL;
291
	while ((ch = getopt(argc, argv, "M:N:")) != -1) {
293
	while ((ch = getopt(argc, argv, "M:N:")) != -1) {
Lines 308-316 Link Here
308
	if (nlistf != NULL && memf == NULL)
310
	if (nlistf != NULL && memf == NULL)
309
		usage();
311
		usage();
310
312
311
	kvm = kvm_open(nlistf, memf, NULL, 0, "umastat");
313
	kvm = kvm_open(nlistf, memf, NULL, 0, errbuf);
312
	if (kvm == NULL)
314
	if (kvm == NULL)
313
		err(-1, "kvm_open");
315
		errx(1, "kvm_openfiles: %s", errbuf);
314
316
315
	if (kvm_nlist(kvm, namelist) != 0)
317
	if (kvm_nlist(kvm, namelist) != 0)
316
		err(-1, "kvm_nlist");
318
		err(-1, "kvm_nlist");
Lines 412-431 Link Here
412
			}
414
			}
413
			printf("  Zone {\n");
415
			printf("  Zone {\n");
414
			printf("    uz_name = \"%s\";\n", name);
416
			printf("    uz_name = \"%s\";\n", name);
415
			printf("    uz_allocs = %llu;\n",
417
			printf("    uz_allocs = %ju;\n",
416
			    uzp_userspace->uz_allocs);
418
			    uzp_userspace->uz_allocs);
417
			printf("    uz_frees = %llu;\n",
419
			printf("    uz_frees = %ju;\n",
418
			    uzp_userspace->uz_frees);
420
			    uzp_userspace->uz_frees);
419
			printf("    uz_fails = %llu;\n",
421
			printf("    uz_fails = %ju;\n",
420
			    uzp_userspace->uz_fails);
422
			    uzp_userspace->uz_fails);
421
			printf("    uz_fills = %u;\n",
423
			printf("    uz_fills = %u;\n",
422
			    uzp_userspace->uz_fills);
424
			    uzp_userspace->uz_fills);
423
			printf("    uz_count = %u;\n",
425
			printf("    uz_count = %u;\n",
424
			    uzp_userspace->uz_count);
426
			    uzp_userspace->uz_count);
425
			uma_print_bucketlist(kvm, (struct bucketlist *)
427
			uma_print_bucketlist(kvm, (void *)
426
			    &uzp_userspace->uz_full_bucket, "uz_full_bucket",
428
			    &uzp_userspace->uz_full_bucket, "uz_full_bucket",
427
			    "    ");
429
			    "    ");
428
			uma_print_bucketlist(kvm, (struct bucketlist *)
430
			uma_print_bucketlist(kvm, (void *)
429
			    &uzp_userspace->uz_free_bucket, "uz_free_bucket",
431
			    &uzp_userspace->uz_free_bucket, "uz_free_bucket",
430
			    "    ");
432
			    "    ");

Return to bug 146119