summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2005-09-26 16:55:11 +0000
committerrwatson <rwatson@FreeBSD.org>2005-09-26 16:55:11 +0000
commitbc29fc3656a39b30c12f24926d35507de55a4075 (patch)
treefe1a1574464c5ad6ddfed43398f96f7866812c3f /sys/kern
parent7557f61ce629b3ccb3914f3737f50ecba40c7131 (diff)
downloadFreeBSD-src-bc29fc3656a39b30c12f24926d35507de55a4075.zip
FreeBSD-src-bc29fc3656a39b30c12f24926d35507de55a4075.tar.gz
Add "show allpcpu" to DDB, which prints the current CPU id followed by
the per-cpu data for all CPUs. This is easier to ask users to do than "figure out how many CPUs you have, now run show pcpu, then run it once for each CPU you have". MFC after: 3 days
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_pcpu.c48
1 files changed, 36 insertions, 12 deletions
diff --git a/sys/kern/subr_pcpu.c b/sys/kern/subr_pcpu.c
index bb58ec6..bacf5ba 100644
--- a/sys/kern/subr_pcpu.c
+++ b/sys/kern/subr_pcpu.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <sys/lock.h>
#include <sys/pcpu.h>
#include <sys/proc.h>
+#include <sys/smp.h>
#include <ddb/ddb.h>
static struct pcpu *cpuid_to_pcpu[MAXCPU];
@@ -97,21 +98,12 @@ pcpu_find(u_int cpuid)
}
#ifdef DDB
-DB_SHOW_COMMAND(pcpu, db_show_pcpu)
+
+static void
+show_pcpu(struct pcpu *pc)
{
- struct pcpu *pc;
struct thread *td;
- int id;
- if (have_addr)
- id = ((addr >> 4) % 16) * 10 + (addr % 16);
- else
- id = PCPU_GET(cpuid);
- pc = pcpu_find(id);
- if (pc == NULL) {
- db_printf("CPU %d not found\n", id);
- return;
- }
db_printf("cpuid = %d\n", pc->pc_cpuid);
db_printf("curthread = ");
td = pc->pc_curthread;
@@ -142,4 +134,36 @@ DB_SHOW_COMMAND(pcpu, db_show_pcpu)
witness_list_locks(&pc->pc_spinlocks);
#endif
}
+
+DB_SHOW_COMMAND(pcpu, db_show_pcpu)
+{
+ struct pcpu *pc;
+ int id;
+
+ if (have_addr)
+ id = ((addr >> 4) % 16) * 10 + (addr % 16);
+ else
+ id = PCPU_GET(cpuid);
+ pc = pcpu_find(id);
+ if (pc == NULL) {
+ db_printf("CPU %d not found\n", id);
+ return;
+ }
+ show_pcpu(pc);
+}
+
+DB_SHOW_COMMAND(allpcpu, db_show_cpu_all)
+{
+ struct pcpu *pc;
+ int id;
+
+ db_printf("Current CPU: %d\n\n", PCPU_GET(cpuid));
+ for (id = 0; id < mp_maxid; id++) {
+ pc = pcpu_find(id);
+ if (pc != NULL) {
+ show_pcpu(pc);
+ db_printf("\n");
+ }
+ }
+}
#endif
OpenPOWER on IntegriCloud