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)
This commit is contained in:
thorpej 2003-09-20 03:02:03 +00:00
parent 3144acc341
commit c7a178e4a9
3 changed files with 31 additions and 5 deletions

View File

@ -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 @@ static const struct db_command db_show_cmds[] = {
{ "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 },

View File

@ -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 @@ void db_kgdb_cmd(db_expr_t, int, db_expr_t, char *);
/* 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 *);

View File

@ -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 @@ db_dmesg(db_expr_t addr, int haddr, db_expr_t count, char *modif)
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);
}
}
}