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