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
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to