Add a `show cpusets' DDB command to print numbered root and

assigned CPU affinity sets.

Reviewed by:	brooks
This commit is contained in:
Bjoern A. Zeeb 2008-07-07 21:32:02 +00:00
parent 45e48455cd
commit dea0ed6690
2 changed files with 41 additions and 1 deletions

View File

@ -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.
.\"

View File

@ -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 @@ cpuset_setaffinity(struct thread *td, struct cpuset_setaffinity_args *uap)
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 */