KNF.
This commit is contained in:
parent
2ca4a3f1c2
commit
e6c31d3db7
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: uvm_stat.c,v 1.6 1998/02/13 04:52:00 thorpej Exp $ */
|
||||
/* $NetBSD: uvm_stat.c,v 1.7 1998/02/13 05:33:55 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* XXXCDC: "ROUGH DRAFT" QUALITY UVM PRE-RELEASE FILE!
|
||||
* XXXCDC: "ROUGH DRAFT" QUALITY UVM PRE-RELEASE FILE!
|
||||
* >>>USE AT YOUR OWN RISK, WORK IS NOT FINISHED<<<
|
||||
*/
|
||||
/*
|
||||
@ -35,7 +35,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* from: Id: uvm_stat.c,v 1.1.2.3 1997/12/19 15:01:00 mrg Exp
|
||||
* from: Id: uvm_stat.c,v 1.1.2.3 1997/12/19 15:01:00 mrg Exp
|
||||
*/
|
||||
|
||||
#include "opt_uvmhist.h"
|
||||
@ -74,75 +74,82 @@ void uvmhist_dump __P((struct uvm_history *));
|
||||
#endif
|
||||
void uvmcnt_dump __P((void));
|
||||
void uvmmap_dump __P((vm_map_t));
|
||||
void uvm_dump __P((void));
|
||||
void uvm_dump __P((void));
|
||||
|
||||
#ifdef UVMHIST
|
||||
/* call this from ddb */
|
||||
void
|
||||
uvmhist_dump(l)
|
||||
|
||||
struct uvm_history *l;
|
||||
|
||||
struct uvm_history *l;
|
||||
{
|
||||
int lcv, s = splhigh();
|
||||
lcv = l->f;
|
||||
do {
|
||||
if (l->e[lcv].fmt)
|
||||
uvmhist_print(&l->e[lcv]);
|
||||
lcv = (lcv + 1) % l->n;
|
||||
} while (lcv != l->f);
|
||||
splx(s);
|
||||
int lcv, s;
|
||||
|
||||
s = splhigh();
|
||||
lcv = l->f;
|
||||
do {
|
||||
if (l->e[lcv].fmt)
|
||||
uvmhist_print(&l->e[lcv]);
|
||||
lcv = (lcv + 1) % l->n;
|
||||
} while (lcv != l->f);
|
||||
splx(s);
|
||||
}
|
||||
#endif
|
||||
#endif /* UVMHIST */
|
||||
|
||||
void
|
||||
uvmcnt_dump()
|
||||
|
||||
{
|
||||
struct uvm_cnt *uvc = uvm_cnt_head;
|
||||
while (uvc) {
|
||||
if ((uvc->t & UVMCNT_MASK) != UVMCNT_CNT) continue;
|
||||
printf("%s = %d\n", uvc->name, uvc->c);
|
||||
uvc = uvc->next;
|
||||
}
|
||||
struct uvm_cnt *uvc = uvm_cnt_head;
|
||||
|
||||
while (uvc) {
|
||||
if ((uvc->t & UVMCNT_MASK) != UVMCNT_CNT)
|
||||
continue;
|
||||
printf("%s = %d\n", uvc->name, uvc->c);
|
||||
uvc = uvc->next;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* uvm_dump: ddb hook to dump interesting uvm counters
|
||||
*/
|
||||
|
||||
void uvm_dump()
|
||||
|
||||
void
|
||||
uvm_dump()
|
||||
{
|
||||
printf("Current UVM status:\n");
|
||||
printf(" pagesize=%d (0x%x), pagemask=0x%x, pageshift=%d\n",
|
||||
uvmexp.pagesize, uvmexp.pagesize, uvmexp.pagemask, uvmexp.pageshift);
|
||||
printf(" %d VM pages: %d active, %d inactive, %d wired, %d free\n",
|
||||
uvmexp.npages, uvmexp.active, uvmexp.inactive, uvmexp.wired, uvmexp.free);
|
||||
printf(" freemin=%d, free-target=%d, inactive-target=%d, wired-max=%d\n",
|
||||
uvmexp.freemin, uvmexp.freetarg, uvmexp.inactarg, uvmexp.wiredmax);
|
||||
printf(" faults=%d, traps=%d, intrs=%d, ctxswitch=%d\n",
|
||||
uvmexp.faults, uvmexp.traps, uvmexp.intrs, uvmexp.swtch);
|
||||
printf(" softint=%d, syscalls=%d, swapins=%d, swapouts=%d\n",
|
||||
uvmexp.softs, uvmexp.syscalls, uvmexp.swapins, uvmexp.swapouts);
|
||||
printf(" fault counts:\n");
|
||||
printf(" noram=%d, noanon=%d, pgwait=%d, pgrele=%d\n",
|
||||
uvmexp.fltnoram, uvmexp.fltnoanon, uvmexp.fltpgwait, uvmexp.fltpgrele);
|
||||
printf(" ok relocks(total)=%d(%d), anget(retrys)=%d(%d), amapcopy=%d\n",
|
||||
uvmexp.fltrelckok, uvmexp.fltrelck, uvmexp.fltanget, uvmexp.fltanretry,
|
||||
uvmexp.fltamcopy);
|
||||
printf(" neighbor anon/obj pg=%d/%d, gets(lock/unlock)=%d/%d\n",
|
||||
uvmexp.fltnamap, uvmexp.fltnomap, uvmexp.fltlget, uvmexp.fltget);
|
||||
printf(" cases: anon=%d, anoncow=%d, obj=%d, prcopy=%d, przero=%d\n",
|
||||
uvmexp.flt_anon, uvmexp.flt_acow, uvmexp.flt_obj, uvmexp.flt_prcopy,
|
||||
uvmexp.flt_przero);
|
||||
printf(" daemon and swap counts:\n");
|
||||
printf(" woke=%d, revs=%d, scans=%d, swout=%d\n", uvmexp.pdwoke,
|
||||
uvmexp.pdrevs, uvmexp.pdscans, uvmexp.pdswout);
|
||||
printf(" busy=%d, freed=%d, reactivate=%d, deactivate=%d\n", uvmexp.pdbusy,
|
||||
uvmexp.pdfreed, uvmexp.pdreact, uvmexp.pddeact);
|
||||
printf(" pageouts=%d, pending=%d, nswget=%d\n", uvmexp.pdpageouts,
|
||||
uvmexp.pdpending, uvmexp.nswget);
|
||||
printf(" nswapdev=%d, nanon=%d, nfreeanon=%d\n", uvmexp.nswapdev,
|
||||
uvmexp.nanon, uvmexp.nfreeanon);
|
||||
|
||||
printf("Current UVM status:\n");
|
||||
printf(" pagesize=%d (0x%x), pagemask=0x%x, pageshift=%d\n",
|
||||
uvmexp.pagesize, uvmexp.pagesize, uvmexp.pagemask,
|
||||
uvmexp.pageshift);
|
||||
printf(" %d VM pages: %d active, %d inactive, %d wired, %d free\n",
|
||||
uvmexp.npages, uvmexp.active, uvmexp.inactive, uvmexp.wired,
|
||||
uvmexp.free);
|
||||
printf(" freemin=%d, free-target=%d, inactive-target=%d, "
|
||||
"wired-max=%d\n", uvmexp.freemin, uvmexp.freetarg, uvmexp.inactarg,
|
||||
uvmexp.wiredmax);
|
||||
printf(" faults=%d, traps=%d, intrs=%d, ctxswitch=%d\n",
|
||||
uvmexp.faults, uvmexp.traps, uvmexp.intrs, uvmexp.swtch);
|
||||
printf(" softint=%d, syscalls=%d, swapins=%d, swapouts=%d\n",
|
||||
uvmexp.softs, uvmexp.syscalls, uvmexp.swapins, uvmexp.swapouts);
|
||||
|
||||
printf(" fault counts:\n");
|
||||
printf(" noram=%d, noanon=%d, pgwait=%d, pgrele=%d\n",
|
||||
uvmexp.fltnoram, uvmexp.fltnoanon, uvmexp.fltpgwait,
|
||||
uvmexp.fltpgrele);
|
||||
printf(" ok relocks(total)=%d(%d), anget(retrys)=%d(%d), "
|
||||
"amapcopy=%d\n", uvmexp.fltrelckok, uvmexp.fltrelck,
|
||||
uvmexp.fltanget, uvmexp.fltanretry, uvmexp.fltamcopy);
|
||||
printf(" neighbor anon/obj pg=%d/%d, gets(lock/unlock)=%d/%d\n",
|
||||
uvmexp.fltnamap, uvmexp.fltnomap, uvmexp.fltlget, uvmexp.fltget);
|
||||
printf(" cases: anon=%d, anoncow=%d, obj=%d, prcopy=%d, przero=%d\n",
|
||||
uvmexp.flt_anon, uvmexp.flt_acow, uvmexp.flt_obj, uvmexp.flt_prcopy,
|
||||
uvmexp.flt_przero);
|
||||
|
||||
printf(" daemon and swap counts:\n");
|
||||
printf(" woke=%d, revs=%d, scans=%d, swout=%d\n", uvmexp.pdwoke,
|
||||
uvmexp.pdrevs, uvmexp.pdscans, uvmexp.pdswout);
|
||||
printf(" busy=%d, freed=%d, reactivate=%d, deactivate=%d\n",
|
||||
uvmexp.pdbusy, uvmexp.pdfreed, uvmexp.pdreact, uvmexp.pddeact);
|
||||
printf(" pageouts=%d, pending=%d, nswget=%d\n", uvmexp.pdpageouts,
|
||||
uvmexp.pdpending, uvmexp.nswget);
|
||||
printf(" nswapdev=%d, nanon=%d, nfreeanon=%d\n", uvmexp.nswapdev,
|
||||
uvmexp.nanon, uvmexp.nfreeanon);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uvm_stat.h,v 1.9 1998/02/13 04:55:14 thorpej Exp $ */
|
||||
/* $NetBSD: uvm_stat.h,v 1.10 1998/02/13 05:33:56 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* XXXCDC: "ROUGH DRAFT" QUALITY UVM PRE-RELEASE FILE!
|
||||
@ -73,22 +73,25 @@ extern struct uvm_cnt *uvm_cnt_head;
|
||||
* counter operations. assume spl is set ok.
|
||||
*/
|
||||
|
||||
#define UVMCNT_INIT(CNT,TYP,VAL,NAM,PRIV) { \
|
||||
#define UVMCNT_INIT(CNT,TYP,VAL,NAM,PRIV) \
|
||||
do { \
|
||||
CNT.c = VAL; \
|
||||
CNT.t = TYP; \
|
||||
CNT.next = uvm_cnt_head; \
|
||||
uvm_cnt_head = &CNT; \
|
||||
CNT.name = NAM; \
|
||||
CNT.p = PRIV; \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define UVMCNT_SET(C,V) { \
|
||||
#define UVMCNT_SET(C,V) \
|
||||
do { \
|
||||
(C).c = (V); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define UVMCNT_ADD(C,V) { \
|
||||
#define UVMCNT_ADD(C,V) \
|
||||
do { \
|
||||
(C).c += (V); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define UVMCNT_INCR(C) UVMCNT_ADD(C,1)
|
||||
#define UVMCNT_DECR(C) UVMCNT_ADD(C,-1)
|
||||
@ -99,23 +102,23 @@ extern struct uvm_cnt *uvm_cnt_head;
|
||||
*/
|
||||
|
||||
struct uvm_history_ent {
|
||||
struct timeval tv; /* time stamp */
|
||||
char *fmt; /* printf format */
|
||||
size_t fmtlen; /* length of printf format */
|
||||
char *fn; /* function name */
|
||||
size_t fnlen; /* length of function name */
|
||||
u_long call; /* function call number */
|
||||
u_long v[4]; /* values */
|
||||
struct timeval tv; /* time stamp */
|
||||
char *fmt; /* printf format */
|
||||
size_t fmtlen; /* length of printf format */
|
||||
char *fn; /* function name */
|
||||
size_t fnlen; /* length of function name */
|
||||
u_long call; /* function call number */
|
||||
u_long v[4]; /* values */
|
||||
};
|
||||
|
||||
struct uvm_history {
|
||||
const char *name; /* name of this this history */
|
||||
size_t namelen; /* length of name, not including null */
|
||||
LIST_ENTRY(uvm_history) list; /* link on list of all histories */
|
||||
int n; /* number of entries */
|
||||
int f; /* next free one */
|
||||
simple_lock_data_t l; /* lock on this history */
|
||||
struct uvm_history_ent *e; /* the malloc'd entries */
|
||||
const char *name; /* name of this this history */
|
||||
size_t namelen; /* length of name, not including null */
|
||||
LIST_ENTRY(uvm_history) list; /* link on list of all histories */
|
||||
int n; /* number of entries */
|
||||
int f; /* next free one */
|
||||
simple_lock_data_t l; /* lock on this history */
|
||||
struct uvm_history_ent *e; /* the malloc'd entries */
|
||||
};
|
||||
|
||||
LIST_HEAD(uvm_history_head, uvm_history);
|
||||
@ -133,7 +136,8 @@ extern struct uvm_history_head uvm_histories;
|
||||
|
||||
#define UVMHIST_DECL(NAME) struct uvm_history NAME
|
||||
|
||||
#define UVMHIST_INIT(NAME,N) { \
|
||||
#define UVMHIST_INIT(NAME,N) \
|
||||
do { \
|
||||
(NAME).name = __STRING(NAME); \
|
||||
(NAME).namelen = strlen((NAME).name); \
|
||||
(NAME).n = (N); \
|
||||
@ -141,12 +145,13 @@ extern struct uvm_history_head uvm_histories;
|
||||
simple_lock_init(&(NAME).l); \
|
||||
(NAME).e = (struct uvm_history_ent *) \
|
||||
malloc(sizeof(struct uvm_history_ent) * (N), M_TEMP, \
|
||||
M_WAITOK); \
|
||||
M_WAITOK); \
|
||||
bzero((NAME).e, sizeof(struct uvm_history_ent) * (N)); \
|
||||
LIST_INSERT_HEAD(&uvm_histories, &(NAME), list); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define UVMHIST_INIT_STATIC(NAME,BUF) { \
|
||||
#define UVMHIST_INIT_STATIC(NAME,BUF) \
|
||||
do { \
|
||||
(NAME).name = __STRING(NAME); \
|
||||
(NAME).namelen = strlen((NAME).name); \
|
||||
(NAME).n = sizeof(BUF) / sizeof(struct uvm_history_ent); \
|
||||
@ -155,31 +160,33 @@ extern struct uvm_history_head uvm_histories;
|
||||
(NAME).e = (struct uvm_history_ent *) (BUF); \
|
||||
bzero((NAME).e, sizeof(struct uvm_history_ent) * (NAME).n); \
|
||||
LIST_INSERT_HEAD(&uvm_histories, &(NAME), list); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
extern int cold;
|
||||
|
||||
#if defined(UVMHIST_PRINT)
|
||||
extern int uvmhist_print_enabled;
|
||||
#define UVMHIST_PRINTNOW(E) \
|
||||
do { \
|
||||
do { \
|
||||
if (uvmhist_print_enabled) { \
|
||||
uvmhist_print(E); \
|
||||
DELAY(100000); \
|
||||
} \
|
||||
} while (0)
|
||||
} while (0)
|
||||
#else
|
||||
#define UVMHIST_PRINTNOW(E) /* nothing */
|
||||
#endif
|
||||
|
||||
#define UVMHIST_LOG(NAME,FMT,A,B,C,D) { \
|
||||
#define UVMHIST_LOG(NAME,FMT,A,B,C,D) \
|
||||
do { \
|
||||
register int i, s = splhigh(); \
|
||||
simple_lock(&(NAME).l); \
|
||||
i = (NAME).f; \
|
||||
(NAME).f = (i + 1) % (NAME).n; \
|
||||
simple_unlock(&(NAME).l); \
|
||||
splx(s); \
|
||||
if (!cold) microtime(&(NAME).e[i].tv); \
|
||||
if (!cold) \
|
||||
microtime(&(NAME).e[i].tv); \
|
||||
(NAME).e[i].fmt = (FMT); \
|
||||
(NAME).e[i].fmtlen = strlen((NAME).e[i].fmt); \
|
||||
(NAME).e[i].fn = _uvmhist_name; \
|
||||
@ -190,13 +197,19 @@ extern int uvmhist_print_enabled;
|
||||
(NAME).e[i].v[2] = (u_long)(C); \
|
||||
(NAME).e[i].v[3] = (u_long)(D); \
|
||||
UVMHIST_PRINTNOW(&((NAME).e[i])); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define UVMHIST_CALLED(NAME) \
|
||||
{ int s = splhigh(); simple_lock(&(NAME).l); \
|
||||
_uvmhist_call = _uvmhist_cnt++; \
|
||||
simple_unlock(&(NAME).l); splx(s); } \
|
||||
UVMHIST_LOG(NAME,"called!", 0, 0, 0, 0);
|
||||
do { \
|
||||
{ \
|
||||
int s = splhigh(); \
|
||||
simple_lock(&(NAME).l); \
|
||||
_uvmhist_call = _uvmhist_cnt++; \
|
||||
simple_unlock(&(NAME).l); \
|
||||
splx(s); \
|
||||
} \
|
||||
UVMHIST_LOG(NAME,"called!", 0, 0, 0, 0); \
|
||||
} while (0)
|
||||
|
||||
#define UVMHIST_FUNC(FNAME) \
|
||||
static int _uvmhist_cnt = 0; \
|
||||
@ -204,18 +217,16 @@ extern int uvmhist_print_enabled;
|
||||
int _uvmhist_call;
|
||||
|
||||
static __inline void uvmhist_print __P((struct uvm_history_ent *));
|
||||
/* shut up GCC */
|
||||
|
||||
static __inline void uvmhist_print(e)
|
||||
|
||||
struct uvm_history_ent *e;
|
||||
static __inline void
|
||||
uvmhist_print(e)
|
||||
struct uvm_history_ent *e;
|
||||
{
|
||||
printf("%06ld.%06ld ", e->tv.tv_sec, e->tv.tv_usec);
|
||||
printf("%s#%ld: ", e->fn, e->call);
|
||||
printf(e->fmt, e->v[0], e->v[1], e->v[2], e->v[3]);
|
||||
printf("\n");
|
||||
printf("%06ld.%06ld ", e->tv.tv_sec, e->tv.tv_usec);
|
||||
printf("%s#%ld: ", e->fn, e->call);
|
||||
printf(e->fmt, e->v[0], e->v[1], e->v[2], e->v[3]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
#endif /* UVMHIST */
|
||||
|
||||
#endif /* _UVM_UVM_STAT_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user