SMP CPU Statistics

Matthew Dillon dillon at apollo.backplane.com
Sat Apr 23 22:12:52 PDT 2005


: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

    We have been slowly moving various statistics from globals to
    per-cpu.  The scheduling stats would be very easy to do but
    they have not yet been moved.

    Would someone like a go at doing the scheduling stats?  Basically
    it means:

    (1) moving the struct cp_time in kern/kern_clock.c into the
        globaldata structure.

    (2) changing the code that updates it in kern/kern_clock.c to update 
	the per-cpu version instead.

    (3) Changing the sysctl to return the cp_time for all cpus in an array.

    (4) Changing libkinfo and libkcore to retrieve and aggregate the
	cp_time info from all the cpus (and to also give an API to allow
	the info from a single cpu to be extracted).

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>





More information about the Users mailing list