summaryrefslogtreecommitdiffstats
path: root/sys
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 /sys
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
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_cpuset.c33
1 files changed, 33 insertions, 0 deletions
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