Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Add a /c modifier to "show pool" to display pool ca...



details:   https://anonhg.NetBSD.org/src/rev/86600bc2a035
branches:  trunk
changeset: 500187:86600bc2a035
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Dec 07 19:30:31 2000 +0000

description:
Add a /c modifier to "show pool" to display pool caches.

diffstat:

 sys/kern/subr_pool.c |  25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diffs (56 lines):

diff -r 08af0ddcd540 -r 86600bc2a035 sys/kern/subr_pool.c
--- a/sys/kern/subr_pool.c      Thu Dec 07 17:51:06 2000 +0000
+++ b/sys/kern/subr_pool.c      Thu Dec 07 19:30:31 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pool.c,v 1.43 2000/12/07 05:45:57 thorpej Exp $   */
+/*     $NetBSD: subr_pool.c,v 1.44 2000/12/07 19:30:31 thorpej Exp $   */
 
 /*-
  * Copyright (c) 1997, 1999, 2000 The NetBSD Foundation, Inc.
@@ -1377,10 +1377,12 @@
 pool_print1(struct pool *pp, const char *modif, void (*pr)(const char *, ...))
 {
        struct pool_item_header *ph;
+       struct pool_cache *pc;
+       struct pool_cache_group *pcg;
 #ifdef DIAGNOSTIC
        struct pool_item *pi;
 #endif
-       int print_log = 0, print_pagelist = 0;
+       int i, print_log = 0, print_pagelist = 0, print_cache = 0;
        char c;
 
        while ((c = *modif++) != '\0') {
@@ -1388,6 +1390,8 @@
                        print_log = 1;
                if (c == 'p')
                        print_pagelist = 1;
+               if (c == 'c')
+                       print_cache = 1;
                modif++;
        }
 
@@ -1444,6 +1448,23 @@
 
  skip_log:
 
+       if (print_cache == 0)
+               goto skip_cache;
+
+       for (pc = TAILQ_FIRST(&pp->pr_cachelist); pc != NULL;
+            pc = TAILQ_NEXT(pc, pc_poollist)) {
+               (*pr)("\tcache %p: allocfrom %p freeto %p\n", pc,
+                   pc->pc_allocfrom, pc->pc_freeto);
+               for (pcg = TAILQ_FIRST(&pc->pc_grouplist); pcg != NULL;
+                    pcg = TAILQ_NEXT(pcg, pcg_list)) {
+                       (*pr)("\t\tgroup %p: avail %d\n", pcg, pcg->pcg_avail);
+                       for (i = 0; i < PCG_NOBJECTS; i++)
+                               (*pr)("\t\t\t%p\n", pcg->pcg_objects[i]);
+               }
+       }
+
+ skip_cache:
+
        pr_enter_check(pp, pr);
 }
 



Home | Main Index | Thread Index | Old Index