Date: Wed, 3 Mar 2004 11:23:34 +0100 From: Bernd Walter <ticso@cicely12.cicely.de> To: Peter Jeremy <peterjeremy@optushome.com.au> Cc: ticso@cicely.de Subject: Re: how to get cpu states more than once a second? Message-ID: <20040303102333.GO44313@cicely12.cicely.de> In-Reply-To: <20040303085724.GA17162@server.vk2pj.dyndns.org> References: <20040303062730.GK44313@cicely12.cicely.de> <20040303085724.GA17162@server.vk2pj.dyndns.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040303102333.GO44313>