Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ddb Add a "show sched_qs" command to dump the run queues...



details:   https://anonhg.NetBSD.org/src/rev/a0b2a6088210
branches:  trunk
changeset: 552148:a0b2a6088210
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Sep 20 03:02:03 2003 +0000

description:
Add a "show sched_qs" command to dump the run queues.  Format is:
 1      pid.lid (p_comm)
        pid.lid (p_comm)
 ...

If a queue has procs, but no sched_whichqs bit, it shows:
!1      pid.lid (p_comm)

diffstat:

 sys/ddb/db_command.c   |   5 +++--
 sys/ddb/db_interface.h |   3 ++-
 sys/ddb/db_xxx.c       |  28 ++++++++++++++++++++++++++--
 3 files changed, 31 insertions(+), 5 deletions(-)

diffs (89 lines):

diff -r 8934fd3b15c7 -r a0b2a6088210 sys/ddb/db_command.c
--- a/sys/ddb/db_command.c      Sat Sep 20 02:19:36 2003 +0000
+++ b/sys/ddb/db_command.c      Sat Sep 20 03:02:03 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_command.c,v 1.71 2003/05/16 16:28:30 itojun Exp $   */
+/*     $NetBSD: db_command.c,v 1.72 2003/09/20 03:02:03 thorpej Exp $  */
 
 /*
  * Mach Operating System
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.71 2003/05/16 16:28:30 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.72 2003/09/20 03:02:03 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -144,6 +144,7 @@
        { "page",       db_page_print_cmd,      0,      NULL },
        { "pool",       db_pool_print_cmd,      0,      NULL },
        { "registers",  db_show_regs,           0,      NULL },
+       { "sched_qs",   db_show_sched_qs,       0,      NULL },
        { "uvmexp",     db_uvmexp_print_cmd,    0,      NULL },
        { "vnode",      db_vnode_print_cmd,     0,      NULL },
        { "watches",    db_listwatch_cmd,       0,      NULL },
diff -r 8934fd3b15c7 -r a0b2a6088210 sys/ddb/db_interface.h
--- a/sys/ddb/db_interface.h    Sat Sep 20 02:19:36 2003 +0000
+++ b/sys/ddb/db_interface.h    Sat Sep 20 03:02:03 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_interface.h,v 1.11 2003/05/22 20:17:11 briggs Exp $ */
+/*     $NetBSD: db_interface.h,v 1.12 2003/09/20 03:02:03 thorpej Exp $        */
 
 /*-
  * Copyright (c) 1995 The NetBSD Foundation, Inc.
@@ -58,6 +58,7 @@
 /* kern/kern_proc.c */
 void           db_kill_proc(db_expr_t, int, db_expr_t, char *);
 void           db_show_all_procs(db_expr_t, int, db_expr_t, char *);
+void           db_show_sched_qs(db_expr_t, int, db_expr_t, char *);
 
 /* kern/kern_clock.c */
 void           db_show_callout(db_expr_t, int, db_expr_t, char *);
diff -r 8934fd3b15c7 -r a0b2a6088210 sys/ddb/db_xxx.c
--- a/sys/ddb/db_xxx.c  Sat Sep 20 02:19:36 2003 +0000
+++ b/sys/ddb/db_xxx.c  Sat Sep 20 03:02:03 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_xxx.c,v 1.27 2003/09/07 14:14:36 uwe Exp $  */
+/*     $NetBSD: db_xxx.c,v 1.28 2003/09/20 03:02:04 thorpej Exp $      */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -39,7 +39,7 @@
 #include "opt_kgdb.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.27 2003/09/07 14:14:36 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.28 2003/09/20 03:02:04 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -272,3 +272,27 @@
        if (!newl)
                db_printf("\n");
 }
+
+void
+db_show_sched_qs(db_expr_t addr, int haddr, db_expr_t count, char *modif)
+{
+       struct prochd *ph;
+       struct lwp *l;
+       int i, first;
+
+       for (i = 0; i < RUNQUE_NQS; i++)
+       {
+               first = 1;
+               ph = &sched_qs[i];
+               for (l = ph->ph_link; l != (struct lwp *)ph; l = l->l_forw) {
+                       if (first) {
+                               db_printf("%c%d",
+                                   (sched_whichqs & (1U << i))
+                                   ? ' ' : '!', i);
+                               first = 0;
+                       }
+                       db_printf("\t%d.%d (%s)\n", l->l_proc->p_pid,
+                           l->l_lid, l->l_proc->p_comm);
+               }
+       }
+}



Home | Main Index | Thread Index | Old Index