Source-Changes-HG archive

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

[src/trunk]: src/sys add ddb commands "show uvmexp" and "show ncache".



details:   https://anonhg.NetBSD.org/src/rev/9548e4b7af24
branches:  trunk
changeset: 499586:9548e4b7af24
user:      chs <chs%NetBSD.org@localhost>
date:      Fri Nov 24 07:25:50 2000 +0000

description:
add ddb commands "show uvmexp" and "show ncache".
the former used to be "call uvm_dump", the latter is new.

diffstat:

 sys/ddb/db_command.c |  31 +++++++++++++++++++++++++---
 sys/ddb/db_command.h |   4 ++-
 sys/kern/vfs_cache.c |  29 ++++++++++++++++++++++++++-
 sys/sys/namei.h      |   3 +-
 sys/uvm/uvm_ddb.h    |  22 ++++++++++----------
 sys/uvm/uvm_stat.c   |  55 ++++++++++++++++++++++++++++-----------------------
 6 files changed, 101 insertions(+), 43 deletions(-)

diffs (truncated from 314 to 300 lines):

diff -r 79b68ca0fde4 -r 9548e4b7af24 sys/ddb/db_command.c
--- a/sys/ddb/db_command.c      Fri Nov 24 07:07:27 2000 +0000
+++ b/sys/ddb/db_command.c      Fri Nov 24 07:25:50 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_command.c,v 1.50 2000/07/08 17:10:22 sommerfeld Exp $       */
+/*     $NetBSD: db_command.c,v 1.51 2000/11/24 07:25:51 chs Exp $      */
 
 /* 
  * Mach Operating System
@@ -38,6 +38,7 @@
 #include <sys/proc.h>
 #include <sys/vnode.h>
 #include <sys/pool.h>
+#include <sys/namei.h>
 
 #include <machine/db_machdep.h>                /* type definitions */
 
@@ -427,8 +428,29 @@
        db_expr_t       count;
        char *          modif;
 {
+       pool_printit((struct pool *)addr, modif, db_printf);
+}
 
-       pool_printit((struct pool *) addr, modif, db_printf);
+/*ARGSUSED*/
+void
+db_namecache_print_cmd(addr, have_addr, count, modif)
+       db_expr_t       addr;
+       int             have_addr;
+       db_expr_t       count;
+       char *          modif;
+{
+       namecache_print((struct vnode *)addr, db_printf);
+}
+
+/*ARGSUSED*/
+void
+db_uvmexp_print_cmd(addr, have_addr, count, modif)
+       db_expr_t       addr;
+       int             have_addr;
+       db_expr_t       count;
+       char *          modif;
+{
+       uvmexp_print(db_printf);
 }
 
 /*
@@ -453,6 +475,8 @@
        { "buf",        db_buf_print_cmd,       0,      NULL },
        { "vnode",      db_vnode_print_cmd,     0,      NULL },
        { "pool",       db_pool_print_cmd,      0,      NULL },
+       { "ncache",     db_namecache_print_cmd, 0,      NULL },
+       { "uvmexp",     db_uvmexp_print_cmd,    0,      NULL },
        { "registers",  db_show_regs,           0,      NULL },
        { "watches",    db_listwatch_cmd,       0,      NULL },
        { NULL,         NULL,                   0,      NULL }
@@ -462,7 +486,6 @@
        { "break",      db_breakpoint_cmd,      0,              NULL },
        { "c",          db_continue_cmd,        0,              NULL },
        { "call",       db_fncall,              CS_OWN,         NULL },
-       { "callout",    db_show_callout,        0,              NULL },
        { "continue",   db_continue_cmd,        0,              NULL },
        { "d",          db_delete_cmd,          0,              NULL },
        { "delete",     db_delete_cmd,          0,              NULL },
@@ -681,7 +704,7 @@
        } else
                mode = 0;
 
-       if (t==tIDENT)
+       if (t == tIDENT)
                db_sifting(db_tok_string, mode);
        else {
                db_printf("Bad argument (non-string)\n");
diff -r 79b68ca0fde4 -r 9548e4b7af24 sys/ddb/db_command.h
--- a/sys/ddb/db_command.h      Fri Nov 24 07:07:27 2000 +0000
+++ b/sys/ddb/db_command.h      Fri Nov 24 07:25:50 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_command.h,v 1.17 2000/05/26 03:34:31 jhawk Exp $    */
+/*     $NetBSD: db_command.h,v 1.18 2000/11/24 07:25:50 chs Exp $      */
 
 /* 
  * Mach Operating System
@@ -43,6 +43,8 @@
 void db_buf_print_cmd __P((db_expr_t, int, db_expr_t, char *));
 void db_vnode_print_cmd __P((db_expr_t, int, db_expr_t, char *));
 void db_pool_print_cmd __P((db_expr_t, int, db_expr_t, char *));
+void db_namecache_print_cmd __P((db_expr_t, int, db_expr_t, char *));
+void db_uvmexp_print_cmd __P((db_expr_t, int, db_expr_t, char *));
 void db_machine_commands_install __P((struct db_command *));
 void db_command_loop __P((void));
 void db_error __P((char *));
diff -r 79b68ca0fde4 -r 9548e4b7af24 sys/kern/vfs_cache.c
--- a/sys/kern/vfs_cache.c      Fri Nov 24 07:07:27 2000 +0000
+++ b/sys/kern/vfs_cache.c      Fri Nov 24 07:25:50 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_cache.c,v 1.27 2000/11/24 05:02:23 chs Exp $       */
+/*     $NetBSD: vfs_cache.c,v 1.28 2000/11/24 07:25:51 chs Exp $       */
 
 /*
  * Copyright (c) 1989, 1993
@@ -35,6 +35,8 @@
  *     @(#)vfs_cache.c 8.3 (Berkeley) 8/22/94
  */
 
+#include "opt_ddb.h"
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/time.h>
@@ -463,3 +465,28 @@
        }
 }
 
+#ifdef DDB
+void
+namecache_print(struct vnode *vp, void (*pr)(const char *, ...))
+{
+       struct vnode *dvp = NULL;
+       struct namecache *ncp;
+
+       TAILQ_FOREACH(ncp, &nclruhead, nc_lru) {
+               if (ncp->nc_vp == vp && ncp->nc_vpid == vp->v_id) {
+                       (*pr)("name %.*s\n", ncp->nc_nlen, ncp->nc_name);
+                       dvp = ncp->nc_dvp;
+               }
+       }
+       if (dvp == NULL) {
+               (*pr)("name not found\n");
+               return;
+       }
+       vp = dvp;
+       TAILQ_FOREACH(ncp, &nclruhead, nc_lru) {
+               if (ncp->nc_vp == vp && ncp->nc_vpid == vp->v_id) {
+                       (*pr)("parent %.*s\n", ncp->nc_nlen, ncp->nc_name);
+               }
+       }
+}
+#endif
diff -r 79b68ca0fde4 -r 9548e4b7af24 sys/sys/namei.h
--- a/sys/sys/namei.h   Fri Nov 24 07:07:27 2000 +0000
+++ b/sys/sys/namei.h   Fri Nov 24 07:25:50 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: namei.h,v 1.19 2000/08/03 20:41:35 thorpej Exp $       */
+/*     $NetBSD: namei.h,v 1.20 2000/11/24 07:25:52 chs Exp $   */
 
 /*
  * Copyright (c) 1985, 1989, 1991, 1993
@@ -192,6 +192,7 @@
 void nchinit __P((void));
 struct mount;
 void cache_purgevfs __P((struct mount *));
+void namecache_print(struct vnode *, void (*)(const char *, ...));
 #endif
 
 /*
diff -r 79b68ca0fde4 -r 9548e4b7af24 sys/uvm/uvm_ddb.h
--- a/sys/uvm/uvm_ddb.h Fri Nov 24 07:07:27 2000 +0000
+++ b/sys/uvm/uvm_ddb.h Fri Nov 24 07:25:50 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_ddb.h,v 1.3 1999/06/21 17:25:11 thorpej Exp $      */
+/*     $NetBSD: uvm_ddb.h,v 1.4 2000/11/24 07:25:52 chs Exp $  */
 
 /*
  *
@@ -40,16 +40,16 @@
 #ifdef _KERNEL
 
 #ifdef DDB
-void                   uvm_map_print __P((vm_map_t, boolean_t));
-void                   uvm_map_printit __P((vm_map_t, boolean_t,
-                               void (*) __P((const char *, ...))));
-
-void                   uvm_object_print __P((struct uvm_object *, boolean_t));
-void                   uvm_object_printit __P((struct uvm_object *, boolean_t,
-                               void (*) __P((const char *, ...))));
-void                   uvm_page_print __P((struct vm_page *, boolean_t));
-void                   uvm_page_printit __P((struct vm_page *, boolean_t,
-                               void (*) __P((const char *, ...))));
+void   uvm_map_print __P((vm_map_t, boolean_t));
+void   uvm_map_printit __P((vm_map_t, boolean_t,
+           void (*) __P((const char *, ...))));
+void   uvm_object_print __P((struct uvm_object *, boolean_t));
+void   uvm_object_printit __P((struct uvm_object *, boolean_t,
+           void (*) __P((const char *, ...))));
+void   uvm_page_print __P((struct vm_page *, boolean_t));
+void   uvm_page_printit __P((struct vm_page *, boolean_t,
+           void (*) __P((const char *, ...))));
+void   uvmexp_print(void (*)(const char *, ...));
 #endif /* DDB */
 
 #endif /* _KERNEL */
diff -r 79b68ca0fde4 -r 9548e4b7af24 sys/uvm/uvm_stat.c
--- a/sys/uvm/uvm_stat.c        Fri Nov 24 07:07:27 2000 +0000
+++ b/sys/uvm/uvm_stat.c        Fri Nov 24 07:25:50 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_stat.c,v 1.14 2000/06/27 17:29:35 mrg Exp $         */
+/*     $NetBSD: uvm_stat.c,v 1.15 2000/11/24 07:25:52 chs Exp $         */
 
 /*
  *
@@ -35,6 +35,7 @@
  */
 
 #include "opt_uvmhist.h"
+#include "opt_ddb.h"
 
 /*
  * uvm_stat.c
@@ -44,6 +45,7 @@
 #include <sys/systm.h>
 
 #include <uvm/uvm.h>
+#include <uvm/uvm_ddb.h>
 
 /*
  * globals
@@ -59,6 +61,8 @@
 int uvmhist_print_enabled = 1;
 #endif
 
+#ifdef DDB
+
 /*
  * prototypes
  */
@@ -69,7 +73,6 @@
 static void uvmhist_dump_histories __P((struct uvm_history *[]));
 #endif
 void uvmcnt_dump __P((void));
-void uvm_dump   __P((void));
 
 
 #ifdef UVMHIST
@@ -199,54 +202,56 @@
 }
 
 /*
- * uvm_dump: ddb hook to dump interesting uvm counters
+ * uvmexp_print: ddb hook to print interesting uvm counters
  */
-void 
-uvm_dump()
+void
+uvmexp_print(void (*pr)(const char *, ...))
 {
 
-       printf("Current UVM status:\n");
-       printf("  pagesize=%d (0x%x), pagemask=0x%x, pageshift=%d\n",
+       (*pr)("Current UVM status:\n");
+       (*pr)("  pagesize=%d (0x%x), pagemask=0x%x, pageshift=%d\n",
            uvmexp.pagesize, uvmexp.pagesize, uvmexp.pagemask,
            uvmexp.pageshift);
-       printf("  %d VM pages: %d active, %d inactive, %d wired, %d free\n",
+       (*pr)("  %d VM pages: %d active, %d inactive, %d wired, %d free\n",
            uvmexp.npages, uvmexp.active, uvmexp.inactive, uvmexp.wired,
            uvmexp.free);
-       printf("  freemin=%d, free-target=%d, inactive-target=%d, "
+       (*pr)("  freemin=%d, free-target=%d, inactive-target=%d, "
            "wired-max=%d\n", uvmexp.freemin, uvmexp.freetarg, uvmexp.inactarg,
            uvmexp.wiredmax);
-       printf("  faults=%d, traps=%d, intrs=%d, ctxswitch=%d\n",
+       (*pr)("  faults=%d, traps=%d, intrs=%d, ctxswitch=%d\n",
            uvmexp.faults, uvmexp.traps, uvmexp.intrs, uvmexp.swtch);
-       printf("  softint=%d, syscalls=%d, swapins=%d, swapouts=%d\n",
+       (*pr)("  softint=%d, syscalls=%d, swapins=%d, swapouts=%d\n",
            uvmexp.softs, uvmexp.syscalls, uvmexp.swapins, uvmexp.swapouts);
 
-       printf("  fault counts:\n");
-       printf("    noram=%d, noanon=%d, pgwait=%d, pgrele=%d\n",
+       (*pr)("  fault counts:\n");
+       (*pr)("    noram=%d, noanon=%d, pgwait=%d, pgrele=%d\n",
            uvmexp.fltnoram, uvmexp.fltnoanon, uvmexp.fltpgwait,
            uvmexp.fltpgrele);
-       printf("    ok relocks(total)=%d(%d), anget(retrys)=%d(%d), "
+       (*pr)("    ok relocks(total)=%d(%d), anget(retrys)=%d(%d), "
            "amapcopy=%d\n", uvmexp.fltrelckok, uvmexp.fltrelck,
            uvmexp.fltanget, uvmexp.fltanretry, uvmexp.fltamcopy);
-       printf("    neighbor anon/obj pg=%d/%d, gets(lock/unlock)=%d/%d\n",
+       (*pr)("    neighbor anon/obj pg=%d/%d, gets(lock/unlock)=%d/%d\n",
            uvmexp.fltnamap, uvmexp.fltnomap, uvmexp.fltlget, uvmexp.fltget);
-       printf("    cases: anon=%d, anoncow=%d, obj=%d, prcopy=%d, przero=%d\n",
+       (*pr)("    cases: anon=%d, anoncow=%d, obj=%d, prcopy=%d, przero=%d\n",
            uvmexp.flt_anon, uvmexp.flt_acow, uvmexp.flt_obj, uvmexp.flt_prcopy,
            uvmexp.flt_przero);
 
-       printf("  daemon and swap counts:\n");
-       printf("    woke=%d, revs=%d, scans=%d, swout=%d\n", uvmexp.pdwoke,
-           uvmexp.pdrevs, uvmexp.pdscans, uvmexp.pdswout);
-       printf("    busy=%d, freed=%d, reactivate=%d, deactivate=%d\n",
+       (*pr)("  daemon and swap counts:\n");
+       (*pr)("    woke=%d, revs=%d, scans=%d, obscans=%d, anscans=%d\n",
+           uvmexp.pdwoke, uvmexp.pdrevs, uvmexp.pdscans, uvmexp.pdobscan,
+           uvmexp.pdanscan);
+       (*pr)("    busy=%d, freed=%d, reactivate=%d, deactivate=%d\n",
            uvmexp.pdbusy, uvmexp.pdfreed, uvmexp.pdreact, uvmexp.pddeact);
-       printf("    pageouts=%d, pending=%d, nswget=%d\n", uvmexp.pdpageouts,
+       (*pr)("    pageouts=%d, pending=%d, nswget=%d\n", uvmexp.pdpageouts,
            uvmexp.pdpending, uvmexp.nswget);
-       printf("    nswapdev=%d, nanon=%d, nanonneeded=%d nfreeanon=%d\n",



Home | Main Index | Thread Index | Old Index