SMP CPU Statistics

Hiten Pandya hmp at backplane.com
Fri Apr 29 05:13:06 PDT 2005


John Leimon wrote:
I'm trying to write a simple CPU load monitor program that can measure load
on multiple CPUs. I have been looking at top and ps sourcecode and have
come across the kinfo_get_sched_cputime function which is basically a
measure of the overall system load. Is there any way to measure load on a
per-cpu basis?
 John
	John, the CPU load statistics are now on a per-cpu basis.  The API
	function, kinfo_get_sched_cputime provides an aggregated view.
	You can use the kern.cputime sysctl for getting an array of struct
	kinfo_cputime, indexed by CPUs.  In a day I will commit a program
	called cpustat(8) which will be able to display CPU load statistics
	for each CPU, just the way top(1) does.
	Hope that helps.

	Kind regards,

			-Hiten
			Hiten Pandya
			hmp at xxxxxxxxxxxxxxxx




More information about the Users mailing list