Home | History | Annotate | Line # | Download | only in uvm
uvm_stat.c revision 1.5
      1 /*	$NetBSD: uvm_stat.c,v 1.5 1998/02/12 20:10:15 thorpej Exp $	*/
      2 
      3 /*
      4  * XXXCDC: "ROUGH DRAFT" QUALITY UVM PRE-RELEASE FILE!
      5  *	   >>>USE AT YOUR OWN RISK, WORK IS NOT FINISHED<<<
      6  */
      7 /*
      8  *
      9  * Copyright (c) 1997 Charles D. Cranor and Washington University.
     10  * All rights reserved.
     11  *
     12  * Redistribution and use in source and binary forms, with or without
     13  * modification, are permitted provided that the following conditions
     14  * are met:
     15  * 1. Redistributions of source code must retain the above copyright
     16  *    notice, this list of conditions and the following disclaimer.
     17  * 2. Redistributions in binary form must reproduce the above copyright
     18  *    notice, this list of conditions and the following disclaimer in the
     19  *    documentation and/or other materials provided with the distribution.
     20  * 3. All advertising materials mentioning features or use of this software
     21  *    must display the following acknowledgement:
     22  *      This product includes software developed by Charles D. Cranor and
     23  *      Washington University.
     24  * 4. The name of the author may not be used to endorse or promote products
     25  *    derived from this software without specific prior written permission.
     26  *
     27  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     28  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     29  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     30  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     31  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     32  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     33  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     34  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     35  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     36  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     37  *
     38  * from: Id: uvm_stat.c,v 1.1.2.3 1997/12/19 15:01:00 mrg Exp
     39  */
     40 
     41 #include "opt_uvmhist.h"
     42 
     43 /*
     44  * uvm_stat.c
     45  */
     46 
     47 #include <sys/param.h>
     48 #include <sys/systm.h>
     49 
     50 #include <vm/vm.h>
     51 
     52 #include <uvm/uvm.h>
     53 
     54 struct uvm_cnt *uvm_cnt_head = NULL;
     55 
     56 /*
     57  * globals
     58  */
     59 
     60 #ifdef UVMHIST_PRINT
     61 int uvmhist_print_enabled = 1;
     62 #endif
     63 
     64 /*
     65  * prototypes
     66  */
     67 
     68 void uvmhist_dump __P((struct uvm_history *));
     69 void uvmcnt_dump __P((void));
     70 void uvmmap_dump __P((vm_map_t));
     71 void uvm_dump __P((void));
     72 
     73 #ifdef UVMHIST
     74 /* call this from ddb */
     75 void
     76 uvmhist_dump(l)
     77 
     78 struct uvm_history *l;
     79 
     80 {
     81   int lcv, s = splhigh();
     82   lcv = l->f;
     83   do {
     84     if (l->e[lcv].fmt)
     85       uvmhist_print(&l->e[lcv]);
     86     lcv = (lcv + 1) % l->n;
     87   } while (lcv != l->f);
     88   splx(s);
     89 }
     90 #endif
     91 
     92 void
     93 uvmcnt_dump()
     94 
     95 {
     96   struct uvm_cnt *uvc = uvm_cnt_head;
     97   while (uvc) {
     98     if ((uvc->t & UVMCNT_MASK) != UVMCNT_CNT) continue;
     99     printf("%s = %d\n", uvc->name, uvc->c);
    100     uvc = uvc->next;
    101   }
    102 }
    103 
    104 /*
    105  * uvm_dump: ddb hook to dump interesting uvm counters
    106  */
    107 
    108 void uvm_dump()
    109 
    110 {
    111   printf("Current UVM status:\n");
    112   printf("  pagesize=%d (0x%x), pagemask=0x%x, pageshift=%d\n",
    113     uvmexp.pagesize, uvmexp.pagesize, uvmexp.pagemask, uvmexp.pageshift);
    114   printf("  %d VM pages: %d active, %d inactive, %d wired, %d free\n",
    115     uvmexp.npages, uvmexp.active, uvmexp.inactive, uvmexp.wired, uvmexp.free);
    116   printf("  freemin=%d, free-target=%d, inactive-target=%d, wired-max=%d\n",
    117     uvmexp.freemin, uvmexp.freetarg, uvmexp.inactarg, uvmexp.wiredmax);
    118   printf("  faults=%d, traps=%d, intrs=%d, ctxswitch=%d\n",
    119     uvmexp.faults, uvmexp.traps, uvmexp.intrs, uvmexp.swtch);
    120   printf("  softint=%d, syscalls=%d, swapins=%d, swapouts=%d\n",
    121     uvmexp.softs, uvmexp.syscalls, uvmexp.swapins, uvmexp.swapouts);
    122   printf("  fault counts:\n");
    123   printf("    noram=%d, noanon=%d, pgwait=%d, pgrele=%d\n",
    124     uvmexp.fltnoram, uvmexp.fltnoanon, uvmexp.fltpgwait, uvmexp.fltpgrele);
    125   printf("    ok relocks(total)=%d(%d), anget(retrys)=%d(%d), amapcopy=%d\n",
    126     uvmexp.fltrelckok, uvmexp.fltrelck, uvmexp.fltanget, uvmexp.fltanretry,
    127     uvmexp.fltamcopy);
    128   printf("    neighbor anon/obj pg=%d/%d, gets(lock/unlock)=%d/%d\n",
    129     uvmexp.fltnamap, uvmexp.fltnomap, uvmexp.fltlget, uvmexp.fltget);
    130   printf("    cases: anon=%d, anoncow=%d, obj=%d, prcopy=%d, przero=%d\n",
    131     uvmexp.flt_anon, uvmexp.flt_acow, uvmexp.flt_obj, uvmexp.flt_prcopy,
    132     uvmexp.flt_przero);
    133   printf("  daemon and swap counts:\n");
    134   printf("    woke=%d, revs=%d, scans=%d, swout=%d\n", uvmexp.pdwoke,
    135     uvmexp.pdrevs, uvmexp.pdscans, uvmexp.pdswout);
    136   printf("    busy=%d, freed=%d, reactivate=%d, deactivate=%d\n", uvmexp.pdbusy,
    137         uvmexp.pdfreed, uvmexp.pdreact, uvmexp.pddeact);
    138   printf("    pageouts=%d, pending=%d, nswget=%d\n", uvmexp.pdpageouts,
    139 	uvmexp.pdpending, uvmexp.nswget);
    140   printf("    nswapdev=%d, nanon=%d, nfreeanon=%d\n", uvmexp.nswapdev,
    141 	uvmexp.nanon, uvmexp.nfreeanon);
    142 }
    143