PERFORCE change 135405 for review
John Baldwin
jhb at FreeBSD.org
Thu Feb 14 12:53:54 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=135405
Change 135405 by jhb at jhb_mutex on 2008/02/14 20:53:35
- Add 'show callouts'
- add test case for pause issue.
Affected files ...
.. //depot/projects/smpng/sys/kern/kern_timeout.c#35 edit
.. //depot/projects/smpng/sys/modules/crash/crash.c#50 edit
Differences ...
==== //depot/projects/smpng/sys/kern/kern_timeout.c#35 (text+ko) ====
@@ -37,6 +37,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/kern/kern_timeout.c,v 1.108 2007/11/22 12:15:54 attilio Exp $");
+#include "opt_ddb.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/callout.h>
@@ -48,6 +50,10 @@
#include <sys/proc.h>
#include <sys/sleepqueue.h>
#include <sys/sysctl.h>
+#ifdef DDB
+#include <ddb/ddb.h>
+#include <ddb/db_sym.h>
+#endif
static int avg_depth;
SYSCTL_INT(_debug, OID_AUTO, to_avg_depth, CTLFLAG_RD, &avg_depth, 0,
@@ -712,3 +718,71 @@
return;
}
#endif /* APM_FIXUP_CALLTODO */
+
+#ifdef DDB
+#if 0
+static void
+db_print_ticks(int ticks)
+{
+ int h, m, s;
+
+ s = ticks / hz;
+ m = s / 60;
+ h = m / 60;
+
+ if (h > 0)
+ printf("%02d:", h);
+ else
+ printf(" ");
+ if (m > 0)
+ printf("%02d:", m % 60);
+ else
+ printf(" ");
+ if (s > 0)
+ printf("%02d.%-4d", s % 60, ticks % hz);
+ else
+ printf(" %4d", ticks);
+}
+#endif
+
+DB_SHOW_COMMAND(callouts, db_show_callouts)
+{
+ struct callout *c;
+ int bucket, callouts, sticks;
+
+ /* First, count the number of callouts. */
+ callouts = 0;
+ for (bucket = 0; bucket < callwheelsize; bucket++) {
+ TAILQ_FOREACH(c, &callwheel[bucket], c_links.tqe) {
+ callouts++;
+ }
+ }
+
+ sticks = softticks;
+ do {
+ bucket = sticks & callwheelmask;
+ TAILQ_FOREACH(c, &callwheel[bucket], c_links.tqe) {
+ if (c->c_time < sticks)
+ continue;
+ if (c->c_time > sticks)
+ break;
+#if 1
+ db_printf("%9d ", c->c_time - softticks);
+#else
+ db_print_ticks(c->c_time - softticks);
+ db_printf(" ");
+#endif
+ db_printsym((db_expr_t)c->c_func, DB_STGY_PROC);
+ db_printf("(%p)", c->c_arg);
+ if (c->c_lock)
+ db_printf(" lock %p (%s)", c->c_lock,
+ c->c_lock->lo_name);
+ db_printf("\n");
+ callouts--;
+ if (db_pager_quit)
+ return;
+ }
+ sticks++;
+ } while (callouts > 0);
+}
+#endif /* DDB */
==== //depot/projects/smpng/sys/modules/crash/crash.c#50 (text+ko) ====
@@ -89,6 +89,15 @@
/* Events. */
+static void
+pause_forever(void *dummy)
+{
+
+ for (;;)
+ pause("foo", 1);
+}
+CRASH_EVENT("pause in an endless loop", pause_forever);
+
static int race_wchan;
static void
More information about the p4-projects
mailing list