Date: Thu, 17 Aug 2006 06:12:34 GMT From: Chris Jones <cdjones@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 104357 for review Message-ID: <200608170612.k7H6CYS6067099@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=104357 Change 104357 by cdjones@cdjones_meanook on 2006/08/17 06:12:23 Keep track of total jailed CPU usage, and make the schedcpu output less frequently spammy. Affected files ... .. //depot/projects/soc2006/cdjones_jail/src/sys/kern/sched_hier.c#12 edit Differences ... ==== //depot/projects/soc2006/cdjones_jail/src/sys/kern/sched_hier.c#12 (text+ko) ==== @@ -178,6 +178,7 @@ #endif static uint32_t total_jail_sched_shares; +static u_int total_est_cpu; extern struct mtx allprison_mtx; extern int prisoncount; @@ -457,6 +458,7 @@ } } sx_slock(&allproc_lock); + total_est_cpu = 0; FOREACH_PROC_IN_SYSTEM(p) { /* * Prevent state changes and protect run queue. @@ -541,6 +543,7 @@ if (kg->kg_slptime > 1) continue; kg->kg_estcpu = decay_cpu(loadfac, kg->kg_estcpu); + total_est_cpu += kg->kg_estcpu; if (kg->kg_proc->p_ucred->cr_prison) kg->kg_proc->p_ucred->cr_prison->pr_estcpu += kg->kg_estcpu; @@ -570,6 +573,7 @@ struct prison *pr; u_int32_t nShares = 0; u_int nCpu = 0; + unsigned int counter = 0; for (;;) { /* @@ -589,8 +593,11 @@ nShares += pr->pr_sched_shares; nCpu += pr->pr_estcpu; } - printf("schedcpu_thread: %d CPU shares total, %d CPU est. usage\n", nShares, nCpu); + if (0 == (counter % 10)) + printf("schedcpu_thread: %d CPU shares total, %d / %d CPU est. usage\n", + nShares, nCpu, total_est_cpu); total_jail_sched_shares = nShares; + counter++; schedcpu(); tsleep(&nowake, 0, "-", hz);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608170612.k7H6CYS6067099>