From owner-freebsd-hackers@FreeBSD.ORG Thu Apr 13 14:21:07 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 EE85D16A400 for ; Thu, 13 Apr 2006 14:21:07 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id EDEF443D8F for ; Thu, 13 Apr 2006 14:21:06 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from localhost (john@localhost [127.0.0.1]) by server.baldwin.cx (8.13.4/8.13.4) with ESMTP id k3DEL26j037332; Thu, 13 Apr 2006 10:21:02 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Thu, 13 Apr 2006 10:20:40 -0400 User-Agent: KMail/1.9.1 References: <20060412215021.GB1146@tols.org> In-Reply-To: <20060412215021.GB1146@tols.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200604131020.42417.jhb@freebsd.org> X-Virus-Scanned: ClamAV 0.87.1/1396/Thu Apr 13 01:39:53 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx Cc: Marco van Tol 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: Thu, 13 Apr 2006 14:21:08 -0000 On Wednesday 12 April 2006 17:50, Marco van Tol wrote: > Hi there, > > My apologies if this is the wrong list to ask this kind of question. > I would appreciate a pointer to the correct list if it is please. :) > > I noticed in the code for gkrellm /usr/ports/sysutils/gkrellm2 that SMP > per-cpu statistics were not yet supported under FreeBSD, and decided to > check whether I could add that. (I'm running a (dual-core) Athlon64 X2 > with FreeBSD 6.1-PRERELEASE) > I can't find sample code and/or documentation on how to acquire that > information from the kernel. > > I checked > - gkrellm2 itself, which uses kern.cp_time in /src/sysdeps/freebsd.c > - top, which also uses kern.cp_time in /usr/src/usr.bin/top/machine.c > > Some browsing around the internet doesn't get me much further either > unfortunately. I keep hitting the per-cpu statistics mentioned with regard > to uma(9). > > Under linux this can be acquired via /proc/stat. (And gkrellm looks realy > funky with per-cpu stats, but that may or may not be relevant depending on > the reader of this mail I guess ;) > > Is there an interface under FreeBSD to acquire the necessary per-cpu > statistics? > > Thank you very much in advance, appreciated, > > Marco van Tol They don't exist currently. I have a patch to make the stats per-CPU for performance reasons (though it only helps out on systems with lots of CPUs (like 10) and hurts on systems with fewer CPUs (like 4)). It doesn't include a sysctl to get the per-CPU stats, but I could add one. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org