Do all of the BSDs have a common way to get CPU stats (time spend in kernel, idle, user, etc) like Linux has in the first line of /proc/stats
?
I'm trying to detect a system under load and not perform computations when it is active (above a certain threshold). I've figured out how to do it on Windows/Linux.
I think I'll need to use sysctl somehow. I've found this:
http://osdir.com/ml/darwin-kernel/2009-06/msg00036.html
Is this cross-platform? I'm trying to target these BSDs in particular:
- Mac OS 10.6+
- FreeBSD 8+
- OpenBSD 5+
I'm only marginally familiar with the BSDs (I played with FreeBSD for a bit as a teenager), so any help would be appreciated.