2011-05-17 08:18:05 +04:00
|
|
|
/* $NetBSD: uvm_stat.c,v 1.37 2011/05/17 04:18:07 mrg Exp $ */
|
1998-02-05 09:25:08 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1997 Charles D. Cranor and Washington University.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
1998-02-07 14:07:38 +03:00
|
|
|
*
|
1998-02-13 08:33:55 +03:00
|
|
|
* from: Id: uvm_stat.c,v 1.1.2.3 1997/12/19 15:01:00 mrg Exp
|
1998-02-05 09:25:08 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* uvm_stat.c
|
|
|
|
*/
|
|
|
|
|
2001-11-10 10:36:59 +03:00
|
|
|
#include <sys/cdefs.h>
|
2011-05-17 08:18:05 +04:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: uvm_stat.c,v 1.37 2011/05/17 04:18:07 mrg Exp $");
|
2001-11-10 10:36:59 +03:00
|
|
|
|
2005-11-29 18:45:28 +03:00
|
|
|
#include "opt_readahead.h"
|
2001-11-10 10:36:59 +03:00
|
|
|
#include "opt_ddb.h"
|
|
|
|
|
1998-02-05 09:25:08 +03:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
2010-12-20 03:25:23 +03:00
|
|
|
#include <sys/cpu.h>
|
1998-02-05 09:25:08 +03:00
|
|
|
|
|
|
|
#include <uvm/uvm.h>
|
2000-11-24 10:25:50 +03:00
|
|
|
#include <uvm/uvm_ddb.h>
|
1998-02-05 09:25:08 +03:00
|
|
|
|
2000-11-24 10:25:50 +03:00
|
|
|
#ifdef DDB
|
|
|
|
|
1998-02-05 09:25:08 +03:00
|
|
|
/*
|
2000-11-24 10:25:50 +03:00
|
|
|
* uvmexp_print: ddb hook to print interesting uvm counters
|
1998-02-05 09:25:08 +03:00
|
|
|
*/
|
2000-11-24 10:25:50 +03:00
|
|
|
void
|
2011-01-06 00:20:44 +03:00
|
|
|
uvmexp_print(void (*pr)(const char *, ...)
|
|
|
|
__attribute__((__format__(__printf__,1,2))))
|
1998-02-05 09:25:08 +03:00
|
|
|
{
|
2006-09-15 19:51:12 +04:00
|
|
|
int active, inactive;
|
2010-12-20 03:25:23 +03:00
|
|
|
CPU_INFO_ITERATOR cii;
|
|
|
|
struct cpu_info *ci;
|
2006-09-15 19:51:12 +04:00
|
|
|
|
|
|
|
uvm_estimatepageable(&active, &inactive);
|
1998-02-13 08:33:55 +03:00
|
|
|
|
2000-11-24 10:25:50 +03:00
|
|
|
(*pr)("Current UVM status:\n");
|
2011-01-04 11:17:01 +03:00
|
|
|
(*pr)(" pagesize=%d (0x%x), pagemask=0x%x, pageshift=%d\n, ncolors=%d",
|
1998-02-13 08:33:55 +03:00
|
|
|
uvmexp.pagesize, uvmexp.pagesize, uvmexp.pagemask,
|
2011-01-04 11:17:01 +03:00
|
|
|
uvmexp.pageshift, uvmexp.ncolors);
|
2000-11-24 10:25:50 +03:00
|
|
|
(*pr)(" %d VM pages: %d active, %d inactive, %d wired, %d free\n",
|
2006-09-15 19:51:12 +04:00
|
|
|
uvmexp.npages, active, inactive, uvmexp.wired,
|
1998-02-13 08:33:55 +03:00
|
|
|
uvmexp.free);
|
2001-12-09 06:07:19 +03:00
|
|
|
(*pr)(" pages %d anon, %d file, %d exec\n",
|
|
|
|
uvmexp.anonpages, uvmexp.filepages, uvmexp.execpages);
|
2006-09-15 19:51:12 +04:00
|
|
|
(*pr)(" freemin=%d, free-target=%d, wired-max=%d\n",
|
|
|
|
uvmexp.freemin, uvmexp.freetarg, uvmexp.wiredmax);
|
2010-12-20 03:25:23 +03:00
|
|
|
|
|
|
|
for (CPU_INFO_FOREACH(cii, ci)) {
|
|
|
|
(*pr)(" cpu%u:\n", cpu_index(ci));
|
|
|
|
(*pr)(" faults=%" PRIu64 ", traps=%" PRIu64 ", "
|
2011-01-06 00:20:44 +03:00
|
|
|
"intrs=%" PRIu64 ", ctxswitch=%" PRIu64 "\n",
|
2010-12-20 03:25:23 +03:00
|
|
|
ci->ci_data.cpu_nfault, ci->ci_data.cpu_ntrap,
|
|
|
|
ci->ci_data.cpu_nintr, ci->ci_data.cpu_nswtch);
|
|
|
|
(*pr)(" softint=%" PRIu64 ", syscalls=%" PRIu64 "\n",
|
|
|
|
ci->ci_data.cpu_nsoft, ci->ci_data.cpu_nsyscall);
|
|
|
|
}
|
1998-02-13 08:33:55 +03:00
|
|
|
|
2000-11-24 10:25:50 +03:00
|
|
|
(*pr)(" fault counts:\n");
|
|
|
|
(*pr)(" noram=%d, noanon=%d, pgwait=%d, pgrele=%d\n",
|
1998-02-13 08:33:55 +03:00
|
|
|
uvmexp.fltnoram, uvmexp.fltnoanon, uvmexp.fltpgwait,
|
|
|
|
uvmexp.fltpgrele);
|
2000-11-24 10:25:50 +03:00
|
|
|
(*pr)(" ok relocks(total)=%d(%d), anget(retrys)=%d(%d), "
|
1998-02-13 08:33:55 +03:00
|
|
|
"amapcopy=%d\n", uvmexp.fltrelckok, uvmexp.fltrelck,
|
|
|
|
uvmexp.fltanget, uvmexp.fltanretry, uvmexp.fltamcopy);
|
2000-11-24 10:25:50 +03:00
|
|
|
(*pr)(" neighbor anon/obj pg=%d/%d, gets(lock/unlock)=%d/%d\n",
|
1998-02-13 08:33:55 +03:00
|
|
|
uvmexp.fltnamap, uvmexp.fltnomap, uvmexp.fltlget, uvmexp.fltget);
|
2000-11-24 10:25:50 +03:00
|
|
|
(*pr)(" cases: anon=%d, anoncow=%d, obj=%d, prcopy=%d, przero=%d\n",
|
1998-02-13 08:33:55 +03:00
|
|
|
uvmexp.flt_anon, uvmexp.flt_acow, uvmexp.flt_obj, uvmexp.flt_prcopy,
|
|
|
|
uvmexp.flt_przero);
|
|
|
|
|
2000-11-24 10:25:50 +03:00
|
|
|
(*pr)(" daemon and swap counts:\n");
|
|
|
|
(*pr)(" woke=%d, revs=%d, scans=%d, obscans=%d, anscans=%d\n",
|
|
|
|
uvmexp.pdwoke, uvmexp.pdrevs, uvmexp.pdscans, uvmexp.pdobscan,
|
|
|
|
uvmexp.pdanscan);
|
|
|
|
(*pr)(" busy=%d, freed=%d, reactivate=%d, deactivate=%d\n",
|
1998-02-13 08:33:55 +03:00
|
|
|
uvmexp.pdbusy, uvmexp.pdfreed, uvmexp.pdreact, uvmexp.pddeact);
|
2000-11-24 10:25:50 +03:00
|
|
|
(*pr)(" pageouts=%d, pending=%d, nswget=%d\n", uvmexp.pdpageouts,
|
1998-02-13 08:33:55 +03:00
|
|
|
uvmexp.pdpending, uvmexp.nswget);
|
2005-05-15 12:01:06 +04:00
|
|
|
(*pr)(" nswapdev=%d, swpgavail=%d\n",
|
|
|
|
uvmexp.nswapdev, uvmexp.swpgavail);
|
|
|
|
(*pr)(" swpages=%d, swpginuse=%d, swpgonly=%d, paging=%d\n",
|
1999-03-26 20:34:15 +03:00
|
|
|
uvmexp.swpages, uvmexp.swpginuse, uvmexp.swpgonly, uvmexp.paging);
|
1998-02-05 09:25:08 +03:00
|
|
|
}
|
2000-11-24 10:25:50 +03:00
|
|
|
#endif
|
2005-11-29 18:45:28 +03:00
|
|
|
|
|
|
|
#if defined(READAHEAD_STATS)
|
|
|
|
|
|
|
|
#define UVM_RA_EVCNT_DEFINE(name) \
|
|
|
|
struct evcnt uvm_ra_##name = \
|
|
|
|
EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "readahead", #name); \
|
|
|
|
EVCNT_ATTACH_STATIC(uvm_ra_##name);
|
|
|
|
|
|
|
|
UVM_RA_EVCNT_DEFINE(total);
|
|
|
|
UVM_RA_EVCNT_DEFINE(hit);
|
|
|
|
UVM_RA_EVCNT_DEFINE(miss);
|
|
|
|
|
|
|
|
#endif /* defined(READAHEAD_STATS) */
|