The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/uvm/uvm_stat.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: uvm_stat.c,v 1.46 2020/06/14 21:41:42 ad Exp $  */
    2 
    3 /*
    4  * Copyright (c) 1997 Charles D. Cranor and Washington University.
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  *
   16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   26  *
   27  * from: Id: uvm_stat.c,v 1.1.2.3 1997/12/19 15:01:00 mrg Exp
   28  */
   29 
   30 /*
   31  * uvm_stat.c
   32  */
   33 
   34 #include <sys/cdefs.h>
   35 __KERNEL_RCSID(0, "$NetBSD: uvm_stat.c,v 1.46 2020/06/14 21:41:42 ad Exp $");
   36 
   37 #include "opt_readahead.h"
   38 #include "opt_ddb.h"
   39 
   40 #include <sys/param.h>
   41 #include <sys/systm.h>
   42 #include <sys/cpu.h>
   43 
   44 #include <uvm/uvm.h>
   45 #include <uvm/uvm_ddb.h>
   46 
   47 #ifdef DDB
   48 
   49 #include <sys/pool.h>
   50 
   51 /*
   52  * uvmexp_print: ddb hook to print interesting uvm counters
   53  */
   54 void
   55 uvmexp_print(void (*pr)(const char *, ...)
   56     __attribute__((__format__(__printf__,1,2))))
   57 {
   58         int64_t anonpg, execpg, filepg;
   59         int active, inactive;
   60         int poolpages, freepg;
   61 
   62         uvm_estimatepageable(&active, &inactive);
   63         poolpages = pool_totalpages_locked();
   64 
   65         /* this will sync all counters. */
   66         freepg = uvm_availmem(false);
   67 
   68         anonpg = cpu_count_get(CPU_COUNT_ANONCLEAN) +
   69             cpu_count_get(CPU_COUNT_ANONDIRTY) +
   70             cpu_count_get(CPU_COUNT_ANONUNKNOWN);
   71         execpg = cpu_count_get(CPU_COUNT_EXECPAGES);
   72         filepg = cpu_count_get(CPU_COUNT_FILECLEAN) +
   73             cpu_count_get(CPU_COUNT_FILEDIRTY) +
   74             cpu_count_get(CPU_COUNT_FILEUNKNOWN) -
   75             execpg;
   76 
   77         (*pr)("Current UVM status:\n");
   78         (*pr)("  pagesize=%d (0x%x), pagemask=0x%x, pageshift=%d, ncolors=%d\n",
   79             uvmexp.pagesize, uvmexp.pagesize, uvmexp.pagemask,
   80             uvmexp.pageshift, uvmexp.ncolors);
   81         (*pr)("  %d VM pages: %d active, %d inactive, %d wired, %d free\n",
   82             uvmexp.npages, active, inactive, uvmexp.wired, freepg);
   83         (*pr)("  pages  %" PRId64 " anon, %" PRId64 " file, %" PRId64 " exec\n",
   84             anonpg, filepg, execpg);
   85         (*pr)("  freemin=%d, free-target=%d, wired-max=%d\n",
   86             uvmexp.freemin, uvmexp.freetarg, uvmexp.wiredmax);
   87         (*pr)("  resv-pg=%d, resv-kernel=%d\n",
   88             uvmexp.reserve_pagedaemon, uvmexp.reserve_kernel);
   89         (*pr)("  bootpages=%d, poolpages=%d\n",
   90             uvmexp.bootpages, poolpages);
   91 
   92         (*pr)("  faults=%" PRId64 ", traps=%" PRId64 ", "
   93               "intrs=%" PRId64 ", ctxswitch=%" PRId64 "\n",
   94             cpu_count_get(CPU_COUNT_NFAULT),
   95             cpu_count_get(CPU_COUNT_NTRAP),
   96             cpu_count_get(CPU_COUNT_NINTR),
   97             cpu_count_get(CPU_COUNT_NSWTCH));
   98         (*pr)("   softint=%" PRId64 ", syscalls=%" PRId64 "\n",
   99             cpu_count_get(CPU_COUNT_NSOFT),
  100             cpu_count_get(CPU_COUNT_NSYSCALL));
  101 
  102         (*pr)("  fault counts:\n");
  103         (*pr)("    noram=%" PRId64 ", noanon=%" PRId64 ", pgwait=%" PRId64
  104             ", pgrele=%" PRId64 "\n",
  105             cpu_count_get(CPU_COUNT_FLTNORAM),
  106             cpu_count_get(CPU_COUNT_FLTNOANON),
  107             cpu_count_get(CPU_COUNT_FLTPGWAIT),
  108             cpu_count_get(CPU_COUNT_FLTPGRELE));
  109         (*pr)("    ok relocks(total)=%" PRId64 "(%" PRId64 "), "
  110             "anget(retrys)=%" PRId64 "(%" PRId64 "), amapcopy=%" PRId64 "\n",
  111             cpu_count_get(CPU_COUNT_FLTRELCKOK),
  112             cpu_count_get(CPU_COUNT_FLTRELCK),
  113             cpu_count_get(CPU_COUNT_FLTANGET),
  114             cpu_count_get(CPU_COUNT_FLTANRETRY),
  115             cpu_count_get(CPU_COUNT_FLTAMCOPY));
  116         (*pr)("    neighbor anon/obj pg=%" PRId64 "/%" PRId64
  117             ", gets(lock/unlock)=%" PRId64 "/%" PRId64 "\n",
  118             cpu_count_get(CPU_COUNT_FLTNAMAP),
  119             cpu_count_get(CPU_COUNT_FLTNOMAP),
  120             cpu_count_get(CPU_COUNT_FLTLGET),
  121             cpu_count_get(CPU_COUNT_FLTGET));
  122         (*pr)("    cases: anon=%" PRId64 ", anoncow=%" PRId64 ", obj=%" PRId64
  123             ", prcopy=%" PRId64 ", przero=%" PRId64 "\n",
  124             cpu_count_get(CPU_COUNT_FLT_ANON),
  125             cpu_count_get(CPU_COUNT_FLT_ACOW),
  126             cpu_count_get(CPU_COUNT_FLT_OBJ),
  127             cpu_count_get(CPU_COUNT_FLT_PRCOPY),
  128             cpu_count_get(CPU_COUNT_FLT_PRZERO));
  129 
  130         (*pr)("  daemon and swap counts:\n");
  131         (*pr)("    woke=%d, revs=%d, scans=%d, obscans=%d, anscans=%d\n",
  132             uvmexp.pdwoke, uvmexp.pdrevs, uvmexp.pdscans, uvmexp.pdobscan,
  133             uvmexp.pdanscan);
  134         (*pr)("    busy=%d, freed=%d, reactivate=%d, deactivate=%d\n",
  135             uvmexp.pdbusy, uvmexp.pdfreed, uvmexp.pdreact, uvmexp.pddeact);
  136         (*pr)("    pageouts=%d, pending=%d, nswget=%d\n", uvmexp.pdpageouts,
  137             uvmexp.pdpending, uvmexp.nswget);
  138         (*pr)("    nswapdev=%d, swpgavail=%d\n",
  139             uvmexp.nswapdev, uvmexp.swpgavail);
  140         (*pr)("    swpages=%d, swpginuse=%d, swpgonly=%d, paging=%d\n",
  141             uvmexp.swpages, uvmexp.swpginuse, uvmexp.swpgonly, uvmexp.paging);
  142 }
  143 #endif
  144 
  145 #if defined(READAHEAD_STATS)
  146 
  147 #define UVM_RA_EVCNT_DEFINE(name) \
  148 struct evcnt uvm_ra_##name = \
  149 EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "readahead", #name); \
  150 EVCNT_ATTACH_STATIC(uvm_ra_##name);
  151 
  152 UVM_RA_EVCNT_DEFINE(total);
  153 UVM_RA_EVCNT_DEFINE(hit);
  154 UVM_RA_EVCNT_DEFINE(miss);
  155 
  156 #endif /* defined(READAHEAD_STATS) */

Cache object: e9033d0253f0f9adfc87e1977f605793


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.