how to get cpu states more than once a second?
Bernd Walter
ticso at cicely12.cicely.de
Wed Mar 3 02:23:48 PST 2004
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 at bwct.de info at bwct.de
More information about the freebsd-hackers
mailing list