From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 3 02:23:48 2004 Return-Path: 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 57CF416A4CE for ; Wed, 3 Mar 2004 02:23:48 -0800 (PST) Received: from srv1.cosmo-project.de (srv1.cosmo-project.de [213.83.6.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id A389843D53 for ; Wed, 3 Mar 2004 02:23:47 -0800 (PST) (envelope-from ticso@cicely12.cicely.de) Received: from cicely5.cicely.de (cicely5.cicely.de [IPv6:3ffe:400:8d0:301:200:92ff:fe9b:20e7]) (authenticated bits=0) i23ANhrQ020485 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Wed, 3 Mar 2004 11:23:45 +0100 (CET) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (cicely12.cicely.de [IPv6:3ffe:400:8d0:301::12]) by cicely5.cicely.de (8.12.10/8.12.10) with ESMTP id i23ANYuL007467 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 3 Mar 2004 11:23:35 +0100 (CET) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (localhost [127.0.0.1]) by cicely12.cicely.de (8.12.10/8.12.10) with ESMTP id i23ANYc5083423; Wed, 3 Mar 2004 11:23:34 +0100 (CET) (envelope-from ticso@cicely12.cicely.de) Received: (from ticso@localhost) by cicely12.cicely.de (8.12.10/8.12.10/Submit) id i23ANYcZ083422; Wed, 3 Mar 2004 11:23:34 +0100 (CET) (envelope-from ticso) Date: Wed, 3 Mar 2004 11:23:34 +0100 From: Bernd Walter To: Peter Jeremy Message-ID: <20040303102333.GO44313@cicely12.cicely.de> References: <20040303062730.GK44313@cicely12.cicely.de> <20040303085724.GA17162@server.vk2pj.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040303085724.GA17162@server.vk2pj.dyndns.org> X-Operating-System: FreeBSD cicely12.cicely.de 5.2-CURRENT alpha User-Agent: Mutt/1.5.4i X-Spam-Status: No, hits=-4.9 required=3.0 tests=BAYES_00 autolearn=ham version=2.61 X-Spam-Report: * -4.9 BAYES_00 BODY: Bayesian spam probability is 0 to 1% * [score: 0.0000] X-Spam-Checker-Version: SpamAssassin 2.61 (1.212.2.1-2003-12-09-exp) on cicely5.cicely.de cc: freebsd-hackers@freebsd.org cc: ticso@cicely.de Subject: Re: how to get cpu states more than once a second? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: ticso@cicely.de List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Mar 2004 10:23:48 -0000 On Wed, Mar 03, 2004 at 07:57:24PM +1100, Peter Jeremy wrote: > On Wed, Mar 03, 2004 at 07:27:31AM +0100, Bernd Walter wrote: > >Currently I get the states via kern.cp_time, but this only allows > >a granularity of a single second and I need something around 50-100ms. > > As far as I can tell - both by studying the source code and by > running "sysctl -x kern.cp_time" in a loop - kern.cp_time increments > continuously. statclock() increments the relevant element in the > array by one at a rate of stathz (128Hz by default). Yes - my fault - the limit was selfmade... > Obviously, you need to smooth the result over a period substantially > longer than 1/128 second to get a useful result (unless you want to > pulse-width modulate your display) but 12.8Hz (stathz/10) would give > you 10 samples which would be ideal for a 10-segment bargraph. It's a 16-segment USB which does the modulation itself. I only need to send a 16bit bitmask. -- B.Walter BWCT http://www.bwct.de ticso@bwct.de info@bwct.de