Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Add hardware ID to cpuctl list
Hi,
I noticed that `cpuctl list` doesn't list the hardware ID of the CPU - it
just shows the "index" under the HwId column. For example:
dmesg | grep cpu1
cpu1 at mainbus0: SUNW,UltraSPARC-II @ 450 MHz, UPA id 2
cpuctl list
Num HwId Unbound LWPs Interrupts Last change
---- ---- ------------ -------------- ----------------------------
1 1 online intr Mon Aug 8 06:09:26 2011
where the HwId of cpu1 should be 2.
The attached adds a cs_hwid field with a value taken from ci_cpuid. I did
consider making cs_id have the same value as ci_cpuid, but cs_id is used as
an index value.
OK to commit?
Thanks,
J
--
My other computer also runs NetBSD / Sailing at Newbiggin
http://www.netbsd.org/ / http://www.newbigginsailingclub.org/
Index: src/sys/sys/cpuio.h
===================================================================
RCS file: /cvsroot/src/sys/sys/cpuio.h,v
retrieving revision 1.4
diff -u -r1.4 cpuio.h
--- src/sys/sys/cpuio.h 19 Apr 2009 14:11:37 -0000 1.4
+++ src/sys/sys/cpuio.h 9 Sep 2011 10:12:08 -0000
@@ -53,7 +53,8 @@
char cs_name[16]; /* reserved */
int32_t cs_lastmodhi; /* time of last state change */
uint32_t cs_intrcnt; /* count of interrupt handlers + 1 */
- uint32_t cs_reserved[2]; /* reserved */
+ uint32_t cs_hwid; /* hardware id */
+ uint32_t cs_reserved; /* reserved */
} cpustate_t;
#define IOC_CPU_SETSTATE _IOW('c', 0, cpustate_t)
Index: src/sys/kern/kern_cpu.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_cpu.c,v
retrieving revision 1.50
diff -u -r1.50 kern_cpu.c
--- src/sys/kern/kern_cpu.c 7 Aug 2011 21:38:32 -0000 1.50
+++ src/sys/kern/kern_cpu.c 9 Sep 2011 10:12:08 -0000
@@ -226,6 +226,7 @@
cs->cs_lastmodhi = (int32_t)
(ci->ci_schedstate.spc_lastmod >> 32);
cs->cs_intrcnt = cpu_intr_count(ci) + 1;
+ cs->cs_hwid = ci->ci_cpuid;
break;
case IOC_CPU_MAPID:
Index: src/usr.sbin/cpuctl/cpuctl.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/cpuctl/cpuctl.c,v
retrieving revision 1.16
diff -u -r1.16 cpuctl.c
--- src/usr.sbin/cpuctl/cpuctl.c 27 Aug 2011 22:38:48 -0000 1.16
+++ src/usr.sbin/cpuctl/cpuctl.c 9 Sep 2011 10:12:08 -0000
@@ -266,7 +266,7 @@
((time_t)cs.cs_lastmodhi << 32);
ts = asctime(localtime(&lastmod));
ts[strlen(ts) - 1] = '\0';
- printf("%-4d %-4x %-12s %-10s %s %s\n", i, cs.cs_id, state,
+ printf("%-4d %-4x %-12s %-10s %s %s\n", i, cs.cs_hwid, state,
intr, ts, ibuf);
}
}
Home |
Main Index |
Thread Index |
Old Index