Source-Changes-HG archive

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

[src/trunk]: src/sys Replace uvm counters with evcnt, initialize them through...



details:   https://anonhg.NetBSD.org/src/rev/c84214824486
branches:  trunk
changeset: 566246:c84214824486
user:      petrov <petrov%NetBSD.org@localhost>
date:      Sat May 01 19:40:39 2004 +0000

description:
Replace uvm counters with evcnt, initialize them through __link_set (from Matt Thomas),
disable counters by default and add configuration option UVMMAP_COUNTERS.

diffstat:

 sys/conf/files     |   4 +-
 sys/uvm/uvm_map.c  |  77 ++++++++++++++++++++++++++++++++---------------------
 sys/uvm/uvm_stat.c |  19 +-----------
 sys/uvm/uvm_stat.h |  51 +-----------------------------------
 4 files changed, 52 insertions(+), 99 deletions(-)

diffs (238 lines):

diff -r 8cb72753140f -r c84214824486 sys/conf/files
--- a/sys/conf/files    Sat May 01 19:09:14 2004 +0000
+++ b/sys/conf/files    Sat May 01 19:40:39 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files,v 1.669 2004/05/01 19:06:24 thorpej Exp $
+#      $NetBSD: files,v 1.670 2004/05/01 19:40:39 petrov Exp $
 
 #      @(#)files.newconf       7.5 (Berkeley) 5/10/93
 
@@ -143,7 +143,7 @@
 # UVM options
 #
 defflag        opt_uvmhist.h           UVMHIST UVMHIST_PRINT
-defflag        opt_uvm.h               USE_TOPDOWN_VM
+defflag        opt_uvm.h               USE_TOPDOWN_VM UVMMAP_COUNTERS
 
 # file system options
 #
diff -r 8cb72753140f -r c84214824486 sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Sat May 01 19:09:14 2004 +0000
+++ b/sys/uvm/uvm_map.c Sat May 01 19:40:39 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_map.c,v 1.168 2004/04/27 09:50:43 junyoung Exp $   */
+/*     $NetBSD: uvm_map.c,v 1.169 2004/05/01 19:40:39 petrov Exp $     */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,10 +71,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.168 2004/04/27 09:50:43 junyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.169 2004/05/01 19:40:39 petrov Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvmhist.h"
+#include "opt_uvm.h"
 #include "opt_sysv.h"
 
 #include <sys/param.h>
@@ -102,11 +103,50 @@
 
 extern struct vm_map *pager_map;
 
-struct uvm_cnt map_ubackmerge, map_uforwmerge;
-struct uvm_cnt map_ubimerge, map_unomerge;
-struct uvm_cnt map_kbackmerge, map_kforwmerge;
-struct uvm_cnt map_kbimerge, map_knomerge;
-struct uvm_cnt uvm_map_call, uvm_mlk_call, uvm_mlk_hint;
+#ifdef UVMMAP_COUNTERS
+#include <sys/device.h>
+struct evcnt map_ubackmerge = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL,
+    "uvmmap", "ubackmerge");
+struct evcnt map_uforwmerge = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL,
+    "uvmmap", "uforwmerge");
+struct evcnt map_ubimerge = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL,
+    "uvmmap", "ubimerge");
+struct evcnt map_unomerge = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL,
+    "uvmmap", "unomerge");
+struct evcnt map_kbackmerge = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL,
+    "uvmmap", "kbackmerge");
+struct evcnt map_kforwmerge = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL,
+    "uvmmap", "kforwmerge");
+struct evcnt map_kbimerge = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL,
+    "uvmmap", "kbimerge");
+struct evcnt map_knomerge = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL,
+    "uvmmap", "knomerge");
+struct evcnt uvm_map_call = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL,
+    "uvmmap", "map_call");
+struct evcnt uvm_mlk_call = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL,
+    "uvmmap", "mlk_call");
+struct evcnt uvm_mlk_hint = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL,
+    "uvmmap", "mlk_hint");
+
+EVCNT_ATTACH_STATIC(map_ubackmerge);
+EVCNT_ATTACH_STATIC(map_uforwmerge);
+EVCNT_ATTACH_STATIC(map_ubimerge);
+EVCNT_ATTACH_STATIC(map_unomerge);
+EVCNT_ATTACH_STATIC(map_kbackmerge);
+EVCNT_ATTACH_STATIC(map_kforwmerge);
+EVCNT_ATTACH_STATIC(map_kbimerge);
+EVCNT_ATTACH_STATIC(map_knomerge);
+EVCNT_ATTACH_STATIC(uvm_map_call);
+EVCNT_ATTACH_STATIC(uvm_mlk_call);
+EVCNT_ATTACH_STATIC(uvm_mlk_hint);
+
+#define UVMCNT_INCR(ev)                ev.ev_count++
+#define UVMCNT_DECR(ev)                ev.ev_count--
+#else
+#define UVMCNT_INCR(ev)
+#define UVMCNT_DECR(ev)
+#endif
+
 const char vmmapbsy[] = "vmmapbsy";
 
 /*
@@ -523,29 +563,6 @@
        UVMHIST_INIT_STATIC(pdhist, pdhistbuf);
        UVMHIST_CALLED(maphist);
        UVMHIST_LOG(maphist,"<starting uvm map system>", 0, 0, 0, 0);
-       UVMCNT_INIT(uvm_map_call, UVMCNT_CNT, 0,
-           "# uvm_map() successful calls", 0);
-
-       UVMCNT_INIT(map_ubackmerge, UVMCNT_CNT, 0,
-           "# uvm_map() back umerges", 0);
-       UVMCNT_INIT(map_uforwmerge, UVMCNT_CNT, 0,
-           "# uvm_map() forward umerges", 0);
-       UVMCNT_INIT(map_ubimerge, UVMCNT_CNT, 0,
-           "# uvm_map() dual umerge", 0);
-       UVMCNT_INIT(map_unomerge, UVMCNT_CNT, 0,
-           "# uvm_map() no umerge", 0);
-
-       UVMCNT_INIT(map_kbackmerge, UVMCNT_CNT, 0,
-           "# uvm_map() back kmerges", 0);
-       UVMCNT_INIT(map_kforwmerge, UVMCNT_CNT, 0,
-           "# uvm_map() forward kmerges", 0);
-       UVMCNT_INIT(map_kbimerge, UVMCNT_CNT, 0,
-           "# uvm_map() dual kmerge", 0);
-       UVMCNT_INIT(map_knomerge, UVMCNT_CNT, 0,
-           "# uvm_map() no kmerge", 0);
-
-       UVMCNT_INIT(uvm_mlk_call, UVMCNT_CNT, 0, "# map lookup calls", 0);
-       UVMCNT_INIT(uvm_mlk_hint, UVMCNT_CNT, 0, "# map lookup hint hits", 0);
 
        /*
         * now set up static pool of kernel map entrys ...
diff -r 8cb72753140f -r c84214824486 sys/uvm/uvm_stat.c
--- a/sys/uvm/uvm_stat.c        Sat May 01 19:09:14 2004 +0000
+++ b/sys/uvm/uvm_stat.c        Sat May 01 19:40:39 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_stat.c,v 1.23 2004/03/24 07:55:01 junyoung Exp $    */
+/*     $NetBSD: uvm_stat.c,v 1.24 2004/05/01 19:40:39 petrov Exp $      */
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_stat.c,v 1.23 2004/03/24 07:55:01 junyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_stat.c,v 1.24 2004/05/01 19:40:39 petrov Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_ddb.h"
@@ -54,8 +54,6 @@
  * globals
  */
 
-struct uvm_cnt *uvm_cnt_head = NULL;
-
 #ifdef UVMHIST
 struct uvm_history_head uvm_histories;
 #endif
@@ -192,19 +190,6 @@
 }
 #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;
-       }
-}
-
 /*
  * uvmexp_print: ddb hook to print interesting uvm counters
  */
diff -r 8cb72753140f -r c84214824486 sys/uvm/uvm_stat.h
--- a/sys/uvm/uvm_stat.h        Sat May 01 19:09:14 2004 +0000
+++ b/sys/uvm/uvm_stat.h        Sat May 01 19:40:39 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_stat.h,v 1.31 2004/04/29 23:13:35 enami Exp $      */
+/*     $NetBSD: uvm_stat.h,v 1.32 2004/05/01 19:40:39 petrov Exp $     */
 
 /*
  *
@@ -48,55 +48,6 @@
  */
 
 /*
- * counters  [XXX: maybe replace event counters with this]
- */
-
-#define UVMCNT_MASK    0xf                     /* rest are private */
-#define UVMCNT_CNT     0                       /* normal counter */
-#define UVMCNT_DEV     1                       /* device event counter */
-
-struct uvm_cnt {
-       int c;                                  /* the value */
-       int t;                                  /* type */
-       struct uvm_cnt *next;                   /* global list of cnts */
-       char *name;                             /* counter name */
-       void *p;                                /* private data */
-};
-
-#ifdef _KERNEL
-
-extern struct uvm_cnt *uvm_cnt_head;
-
-/*
- * counter operations.  assume spl is set ok.
- */
-
-#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 (/*CONSTCOND*/ 0)
-
-#define UVMCNT_SET(C,V) \
-do { \
-       (C).c = (V); \
-} while (/*CONSTCOND*/ 0)
-
-#define UVMCNT_ADD(C,V) \
-do { \
-       (C).c += (V); \
-} while (/*CONSTCOND*/ 0)
-
-#define UVMCNT_INCR(C) UVMCNT_ADD(C,1)
-#define UVMCNT_DECR(C) UVMCNT_ADD(C,-1)
-
-#endif /* _KERNEL */
-
-/*
  * history/tracing
  */
 



Home | Main Index | Thread Index | Old Index