Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/vmstat When summarizing pool memory usage, account f...



details:   https://anonhg.NetBSD.org/src/rev/9c334dbd65c8
branches:  trunk
changeset: 515893:9c334dbd65c8
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Sun Oct 07 12:50:54 2001 +0000

description:
When summarizing pool memory usage, account for PR_RECURSIVE pools
specially so as to avoid counting the same memory twice.

diffstat:

 usr.bin/vmstat/vmstat.c |  18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r 43cdeca53bed -r 9c334dbd65c8 usr.bin/vmstat/vmstat.c
--- a/usr.bin/vmstat/vmstat.c   Sun Oct 07 12:45:03 2001 +0000
+++ b/usr.bin/vmstat/vmstat.c   Sun Oct 07 12:50:54 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.83 2001/08/26 02:50:37 matt Exp $ */
+/* $NetBSD: vmstat.c,v 1.84 2001/10/07 12:50:54 bjh21 Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -80,7 +80,7 @@
 #if 0
 static char sccsid[] = "@(#)vmstat.c   8.2 (Berkeley) 3/1/95";
 #else
-__RCSID("$NetBSD: vmstat.c,v 1.83 2001/08/26 02:50:37 matt Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.84 2001/10/07 12:50:54 bjh21 Exp $");
 #endif
 #endif /* not lint */
 
@@ -1061,8 +1061,18 @@
                PRWORD(ovflw, " %*s", 6, 1, maxp);
                PRWORD(ovflw, " %*lu\n", 5, 1, pp->pr_nidle);
 
-               inuse += (pp->pr_nget - pp->pr_nput) * pp->pr_size;
-               total += pp->pr_npages * pp->pr_pagesz;
+               if (pp->pr_roflags & PR_RECURSIVE) {
+                       /*
+                        * Don't count in-use memory, since it's part
+                        * of another pool and will be accounted for
+                        * there.
+                        */
+                       total += pp->pr_npages * pp->pr_pagesz -
+                            (pp->pr_nget - pp->pr_nput) * pp->pr_size;
+               } else {
+                       inuse += (pp->pr_nget - pp->pr_nput) * pp->pr_size;
+                       total += pp->pr_npages * pp->pr_pagesz;
+               }
                addr = (long)TAILQ_NEXT(pp, pr_poollist);
        }
 



Home | Main Index | Thread Index | Old Index