Source-Changes-HG archive

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

[src/trunk]: src/sys/kern ddb: add two new modifiers to "show pool" and "show...



details:   https://anonhg.NetBSD.org/src/rev/1f70194d65b5
branches:  trunk
changeset: 979223:1f70194d65b5
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Dec 19 23:38:21 2020 +0000

description:
ddb: add two new modifiers to "show pool" and "show all pools"

- /s shows a short single-line per pool list (the normal output
  is about 10 lines per.)
- /S skips pools with zero allocations.

diffstat:

 share/man/man4/ddb.4 |  15 +++++++++++----
 sys/kern/subr_pool.c |  39 +++++++++++++++++++++++++++++----------
 2 files changed, 40 insertions(+), 14 deletions(-)

diffs (140 lines):

diff -r 686ecad211f5 -r 1f70194d65b5 share/man/man4/ddb.4
--- a/share/man/man4/ddb.4      Sat Dec 19 23:32:36 2020 +0000
+++ b/share/man/man4/ddb.4      Sat Dec 19 23:38:21 2020 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: ddb.4,v 1.196 2020/10/31 22:43:01 uwe Exp $
+.\"    $NetBSD: ddb.4,v 1.197 2020/12/19 23:38:21 mrg Exp $
 .\"
 .\" Copyright (c) 1997 - 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -56,7 +56,7 @@
 .\" any improvements or extensions that they make and grant Carnegie Mellon
 .\" the rights to redistribute these changes.
 .\"
-.Dd August 23, 2020
+.Dd December 19, 2020
 .Dt DDB 4
 .Os
 .Sh NAME
@@ -584,7 +584,7 @@
 Display basic information about all physical pages managed by the VM system.
 For more detailed information about a single page, use
 .Ic show page .
-.It Ic show all pools Ns Op Cm /clp
+.It Ic show all pools Ns Op Cm /clpsS
 Display all pool information.
 Modifiers are the same as
 .Ic show pool .
@@ -721,7 +721,7 @@
 is specified, the complete page is printed.
 .It Ic show panic
 Print the current "panic" string.
-.It Ic show pool Ns Oo Cm /clp Oc Ar address
+.It Ic show pool Ns Oo Cm /clpsS Oc Ar address
 Print the pool at
 .Ar address .
 Valid modifiers:
@@ -732,6 +732,13 @@
 Print the log entries for this pool.
 .It Cm /p
 Print the pagelist for this pool.
+.It Cm /s
+Print a short (one line) list per pool, showing the wait channel, pool
+address, allocation size, alignment, allocated pages, allocated items,
+consumed items, allocation requests, allocation frees, pages allocated,
+pages freed, and currently idle pages, respectively.
+.It Cm /S
+Skip pools with zero allocations.
 .El
 .It Ic show proc Ns Oo Cm /ap Oc Ar address | pid
 Show information about a process and its LWPs.
diff -r 686ecad211f5 -r 1f70194d65b5 sys/kern/subr_pool.c
--- a/sys/kern/subr_pool.c      Sat Dec 19 23:32:36 2020 +0000
+++ b/sys/kern/subr_pool.c      Sat Dec 19 23:38:21 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pool.c,v 1.274 2020/09/05 17:33:11 riastradh Exp $        */
+/*     $NetBSD: subr_pool.c,v 1.275 2020/12/19 23:38:21 mrg Exp $      */
 
 /*
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018,
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.274 2020/09/05 17:33:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.275 2020/12/19 23:38:21 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1833,28 +1833,47 @@
        pool_cache_cpu_t *cc;
        uint64_t cpuhit, cpumiss, pchit, pcmiss;
        uint32_t nfull;
-       int i, print_log = 0, print_pagelist = 0, print_cache = 0;
+       int i;
+       bool print_log = false, print_pagelist = false, print_cache = false;
+       bool print_short = false, skip_empty = false;
        char c;
 
        while ((c = *modif++) != '\0') {
                if (c == 'l')
-                       print_log = 1;
+                       print_log = true;
                if (c == 'p')
-                       print_pagelist = 1;
+                       print_pagelist = true;
                if (c == 'c')
-                       print_cache = 1;
+                       print_cache = true;
+               if (c == 's')
+                       print_short = true;
+               if (c == 'S')
+                       skip_empty = true;
        }
 
+       if (skip_empty && pp->pr_nget == 0)
+               return;
+
        if ((pc = pp->pr_cache) != NULL) {
-               (*pr)("POOL CACHE");
+               (*pr)("POOLCACHE");
        } else {
                (*pr)("POOL");
        }
 
+       /* Single line output. */
+       if (print_short) {
+               (*pr)(" %s:%p:%u:%u:%u:%u:%u:%u:%u:%u:%u:%u\n",
+                   pp->pr_wchan, pp, pp->pr_size, pp->pr_align, pp->pr_npages,
+                   pp->pr_nitems, pp->pr_nout, pp->pr_nget, pp->pr_nput,
+                   pp->pr_npagealloc, pp->pr_npagefree, pp->pr_nidle);
+               
+               return;
+       }
+
        (*pr)(" %s: size %u, align %u, ioff %u, roflags 0x%08x\n",
            pp->pr_wchan, pp->pr_size, pp->pr_align, pp->pr_itemoffset,
            pp->pr_roflags);
-       (*pr)("\talloc %p\n", pp->pr_alloc);
+       (*pr)("\tpool %p, alloc %p\n", pp, pp->pr_alloc);
        (*pr)("\tminitems %u, minpages %u, maxpages %u, npages %u\n",
            pp->pr_minitems, pp->pr_minpages, pp->pr_maxpages, pp->pr_npages);
        (*pr)("\titemsperpage %u, nitems %u, nout %u, hardlimit %u\n",
@@ -1865,7 +1884,7 @@
        (*pr)("\tnpagealloc %lu, npagefree %lu, hiwat %u, nidle %lu\n",
            pp->pr_npagealloc, pp->pr_npagefree, pp->pr_hiwat, pp->pr_nidle);
 
-       if (print_pagelist == 0)
+       if (!print_pagelist)
                goto skip_pagelist;
 
        if ((ph = LIST_FIRST(&pp->pr_emptypages)) != NULL)
@@ -1884,7 +1903,7 @@
                (*pr)("\tcurpage %p\n", pp->pr_curpage->ph_page);
 
  skip_pagelist:
-       if (print_log == 0)
+       if (print_log)
                goto skip_log;
 
        (*pr)("\n");



Home | Main Index | Thread Index | Old Index