From owner-p4-projects@FreeBSD.ORG Thu Aug 17 06:12:35 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4528B16A4E0; Thu, 17 Aug 2006 06:12:35 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0688C16A4DD for ; Thu, 17 Aug 2006 06:12:35 +0000 (UTC) (envelope-from cdjones@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id C98AF43D46 for ; Thu, 17 Aug 2006 06:12:34 +0000 (GMT) (envelope-from cdjones@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k7H6CYjw067102 for ; Thu, 17 Aug 2006 06:12:34 GMT (envelope-from cdjones@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k7H6CYS6067099 for perforce@freebsd.org; Thu, 17 Aug 2006 06:12:34 GMT (envelope-from cdjones@FreeBSD.org) Date: Thu, 17 Aug 2006 06:12:34 GMT Message-Id: <200608170612.k7H6CYS6067099@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to cdjones@FreeBSD.org using -f From: Chris Jones To: Perforce Change Reviews Cc: Subject: PERFORCE change 104357 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2006 06:12:35 -0000 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);