Subject: MP interface: iterating over CPU's..
To: None <tech-smp@netbsd.org, tech-ports@netbsd.org>
From: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
List: tech-smp
Date: 09/23/2000 20:49:04
A few places in the system (first thing on the list is the
kern.cp_time sysctl and thereabouts) want to look at the "struct
cpu_info" for each running CPU in the system.

I'd like an abstract iterator interface, so that ports can either use
a dense array or a linked list depending on what makes sense..

{
	struct cpu_info *ci;
	CPU_INFO_ITERATOR cii;
	int i;

	for (CPU_INFO_ITERATE(cii, ci)) {
		for (i=0; i<NCPUSTATES; i++) 
			cp_time[i] += ci->ci_schedstate->spc_cp_time[i];
	}
}

.. as well as an abstract interface to get the cpu_info for a cpu
known by id:

struct cpu_info *CPU_INFO(cpuid_t cpuid);

Comments?

					- Bill