From owner-freebsd-hackers@FreeBSD.ORG Mon Apr 17 13:48:30 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7CD1216A441; Mon, 17 Apr 2006 13:48:30 +0000 (UTC) (envelope-from marco@goofy.tols.org) Received: from goofy.tols.org (goofy.demon.nl [83.160.134.92]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4756E43D48; Mon, 17 Apr 2006 13:48:28 +0000 (GMT) (envelope-from marco@goofy.tols.org) Received: from goofy.tols.org (localhost [127.0.0.1]) by goofy.tols.org (8.13.4/8.13.4) with ESMTP id k3HDmQgt047515; Mon, 17 Apr 2006 13:48:26 GMT (envelope-from marco@goofy.tols.org) Received: (from marco@localhost) by goofy.tols.org (8.13.4/8.13.4/Submit) id k3HDmQxZ047514; Mon, 17 Apr 2006 13:48:26 GMT (envelope-from marco) Date: Mon, 17 Apr 2006 13:48:25 +0000 From: Marco van Tol To: John Baldwin Message-ID: <20060417134825.GA47043@tols.org> Mail-Followup-To: John Baldwin , freebsd-hackers@freebsd.org References: <20060412215021.GB1146@tols.org> <200604141017.30635.jhb@freebsd.org> <20060415104005.GB27978@tols.org> <200604170904.58902.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200604170904.58902.jhb@freebsd.org> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: ClamAV 0.88.1/1403/Sun Apr 16 09:44:45 2006 on goofy.tols.org X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on goofy.tols.org Cc: freebsd-hackers@freebsd.org Subject: Re: Per CPU cpu-statistics under SMP X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Apr 2006 13:48:30 -0000 On Mon, Apr 17, 2006 at 09:04:58AM -0400, John Baldwin wrote: > On Saturday 15 April 2006 06:40 am, Marco van Tol wrote: > > On Fri, Apr 14, 2006 at 10:17:29AM -0400, John Baldwin wrote: [...] > > > An early one but it doesn't export the data to userland yet. I need to > > > figure out what interface to use for that. I could have the cp_time > > > sysctl just include the CPU arrays after the global array and key > > > off the passed in length to determine if they should be included or not. > > > > I must admit that I had to read up a bit to understand what you meant here, > > but I think I do now. I think it should work. > > If I understand correctly, the first array would have the composite CPU > > stats, and following arrays would be the CPU specific stats. Right? > > That'd be just like the linux /proc/stat. > > > > In case it's going to be done like this, will the sum of the CPU specific > > stats be the composite stats? > > Yes. > > > I'm not familiar with the formal process of adding/changing sysctl's for > > the kernel, so can't give much more comment. :) > > I'm assuming there are formal guidelines to do things like that. > > I actually did it differently though to try and make it less confusing. > I've added a kern.pcpu_time sysctl which is an array of 0..mp_maxid > cp_time[] arrays (so (mp_maxid + 1) * CPUSTATES longs) which is just the > per-CPU data. Userland can sum them up if it wants a composite total. > Userland would first do a sysctl with a NULL buffer to get the required > size (since it can vary with the number of CPUs in the system), malloc() > a buffer, and then use the malloc'd buffer to make the requests. You > should only have to do the malloc() at process start since FreeBSD doesn't > currently allow for more CPUs to be added at runtime. You can try out > the patch at http://www.FreeBSD.org/~jhb/patches/cp_time.patch Great thanks! I will try to apply the patch, and try to modify gkrellm to support it. I'll drop them (gkrellm developers) a note that I'm doing this, as it would be a waist of effort if somebody else has been doing preliminary work that I'd be doing again. :) I'll keep you up-to-date. Thanks. Marco -- Ik heb een hekel aan bumper-klevers, vanochtend zat er weer een voor me.