using get_system_info() - obtaining system load averages

Peter Jeremy PeterJeremy at optushome.com.au
Tue Jan 10 20:12:21 PST 2006


On Tue, 2006-Jan-10 17:55:04 -0800, kamal kc wrote:
>after i put my code i got a very high amount of interrupts (irq 21:
>xl1 interrupts) that overloads the cpu withing seconds if i pump
>about 4Mbps traffic through it.
>
>so i thought as a temp solution that i could turn off the compression
>if ever the cpu gets overloaded and that's it.

Load average isn't a good way of doing this.  averunnable.ldavg[0]
represents an exponential decay average of the run queue length that
is updated (roughly) every 5 seconds with a 1 minute period.  This is
useless at measuring short-term CPU load.  cp_time[] is probably a
better choice for you - it uses statclock to report the CPU
utilisation (every statclock interval, one element of the array is
incremented) so you can (fairly) immediately detect if you have
overloaded the CPU (for some definition of "overload").

-- 
Peter Jeremy


More information about the freebsd-hackers mailing list