summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2008-07-07 21:32:02 +0000
committerbz <bz@FreeBSD.org>2008-07-07 21:32:02 +0000
commitf93b85c0df19ba2ac2d9d9b9199172efde9adb3e (patch)
tree3fec05068a786ac3b8ff176ff7a61f0368576829
parent6988e35234522c9659ed9da198e29f748d55a6ac (diff)
downloadFreeBSD-src-f93b85c0df19ba2ac2d9d9b9199172efde9adb3e.zip
FreeBSD-src-f93b85c0df19ba2ac2d9d9b9199172efde9adb3e.tar.gz
Add a `show cpusets' DDB command to print numbered root and
assigned CPU affinity sets. Reviewed by: brooks
-rw-r--r--share/man/man4/ddb.49
-rw-r--r--sys/kern/kern_cpuset.c33
2 files changed, 41 insertions, 1 deletions
diff --git a/share/man/man4/ddb.4 b/share/man/man4/ddb.4
index e0a8a25..f822071 100644
--- a/share/man/man4/ddb.4
+++ b/share/man/man4/ddb.4
@@ -60,7 +60,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd June 8, 2008
+.Dd July 7, 2008
.Dt DDB 4
.Os
.Sh NAME
@@ -584,6 +584,13 @@ header file.
Show brief information about the TTY subsystem.
.\"
.Pp
+.It Ic show Cm cpusets
+Print numbered root and assigned CPU affinity sets.
+See
+.Xr cpuset 2
+for more details.
+.\"
+.Pp
.It Ic show Cm cyrixreg
Show registers specific to the Cyrix processor.
.\"
diff --git a/sys/kern/kern_cpuset.c b/sys/kern/kern_cpuset.c
index ee27a0b..2a4c248 100644
--- a/sys/kern/kern_cpuset.c
+++ b/sys/kern/kern_cpuset.c
@@ -31,6 +31,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_ddb.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysproto.h>
@@ -54,6 +56,10 @@ __FBSDID("$FreeBSD$");
#include <vm/uma.h>
+#ifdef DDB
+#include <ddb/ddb.h>
+#endif /* DDB */
+
/*
* cpusets provide a mechanism for creating and manipulating sets of
* processors for the purpose of constraining the scheduling of threads to
@@ -975,3 +981,30 @@ out:
free(mask, M_TEMP);
return (error);
}
+
+#ifdef DDB
+DB_SHOW_COMMAND(cpusets, db_show_cpusets)
+{
+ struct cpuset *set;
+ int cpu, once;
+
+ LIST_FOREACH(set, &cpuset_ids, cs_link) {
+ db_printf("set=%p id=%-6u ref=%-6d flags=0x%04x parent id=%d\n",
+ set, set->cs_id, set->cs_ref, set->cs_flags,
+ (set->cs_parent != NULL) ? set->cs_parent->cs_id : 0);
+ db_printf(" mask=");
+ for (once = 0, cpu = 0; cpu < CPU_SETSIZE; cpu++) {
+ if (CPU_ISSET(cpu, &set->cs_mask)) {
+ if (once == 0) {
+ db_printf("%d", cpu);
+ once = 1;
+ } else
+ db_printf(",%d", cpu);
+ }
+ }
+ db_printf("\n");
+ if (db_pager_quit)
+ break;
+ }
+}
+#endif /* DDB */
OpenPOWER on IntegriCloud