summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-02-04 14:49:47 +0000
committerkib <kib@FreeBSD.org>2015-02-04 14:49:47 +0000
commitc87d139b4731dfe451c6baa8c44ab24f5f5f847c (patch)
tree44d9bc695951456641782ffc441c24cab7abd5d1
parent781f1450865a06bce8506688398236757554cca5 (diff)
downloadFreeBSD-src-c87d139b4731dfe451c6baa8c44ab24f5f5f847c.zip
FreeBSD-src-c87d139b4731dfe451c6baa8c44ab24f5f5f847c.tar.gz
Add ddb command 'show clocksource' to display state of the per-cpu
clock events. Sponsored by: The FreeBSD Foundation MFC after: 1 week
-rw-r--r--sys/kern/kern_clocksource.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/sys/kern/kern_clocksource.c b/sys/kern/kern_clocksource.c
index 4178513..cbbbce4 100644
--- a/sys/kern/kern_clocksource.c
+++ b/sys/kern/kern_clocksource.c
@@ -908,3 +908,42 @@ sysctl_kern_eventtimer_periodic(SYSCTL_HANDLER_ARGS)
SYSCTL_PROC(_kern_eventtimer, OID_AUTO, periodic,
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,
0, 0, sysctl_kern_eventtimer_periodic, "I", "Enable event timer periodic mode");
+
+#include "opt_ddb.h"
+
+#ifdef DDB
+#include <ddb/ddb.h>
+
+DB_SHOW_COMMAND(clocksource, db_show_clocksource)
+{
+ struct pcpu_state *st;
+ int c;
+
+ CPU_FOREACH(c) {
+ st = DPCPU_ID_PTR(c, timerstate);
+ db_printf(
+ "CPU %2d: action %d handle %d ipi %d idle %d\n"
+ " now %#jx nevent %#jx (%jd)\n"
+ " ntick %#jx (%jd) nhard %#jx (%jd)\n"
+ " nstat %#jx (%jd) nprof %#jx (%jd)\n"
+ " ncall %#jx (%jd) ncallopt %#jx (%jd)\n",
+ c, st->action, st->handle, st->ipi, st->idle,
+ (uintmax_t)st->now,
+ (uintmax_t)st->nextevent,
+ (uintmax_t)(st->nextevent - st->now) / tick_sbt,
+ (uintmax_t)st->nexttick,
+ (uintmax_t)(st->nexttick - st->now) / tick_sbt,
+ (uintmax_t)st->nexthard,
+ (uintmax_t)(st->nexthard - st->now) / tick_sbt,
+ (uintmax_t)st->nextstat,
+ (uintmax_t)(st->nextstat - st->now) / tick_sbt,
+ (uintmax_t)st->nextprof,
+ (uintmax_t)(st->nextprof - st->now) / tick_sbt,
+ (uintmax_t)st->nextcall,
+ (uintmax_t)(st->nextcall - st->now) / tick_sbt,
+ (uintmax_t)st->nextcallopt,
+ (uintmax_t)(st->nextcallopt - st->now) / tick_sbt);
+ }
+}
+
+#endif
OpenPOWER on IntegriCloud