Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/librump/rumpkern Gather some statistics about biglo...



details:   https://anonhg.NetBSD.org/src/rev/2890836725c7
branches:  trunk
changeset: 781951:2890836725c7
user:      pooka <pooka%NetBSD.org@localhost>
date:      Tue Oct 09 13:35:50 2012 +0000

description:
Gather some statistics about biglock usage.

diffstat:

 sys/rump/librump/rumpkern/klock.c        |  25 +++++++++++++++++++++++--
 sys/rump/librump/rumpkern/rump.c         |   6 ++++--
 sys/rump/librump/rumpkern/rump_private.h |   3 ++-
 3 files changed, 29 insertions(+), 5 deletions(-)

diffs (105 lines):

diff -r 8bd69b524fad -r 2890836725c7 sys/rump/librump/rumpkern/klock.c
--- a/sys/rump/librump/rumpkern/klock.c Tue Oct 09 10:25:44 2012 +0000
+++ b/sys/rump/librump/rumpkern/klock.c Tue Oct 09 13:35:50 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: klock.c,v 1.4 2012/02/20 22:35:14 mrg Exp $    */
+/*     $NetBSD: klock.c,v 1.5 2012/10/09 13:35:50 pooka Exp $  */
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -29,10 +29,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: klock.c,v 1.4 2012/02/20 22:35:14 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: klock.c,v 1.5 2012/10/09 13:35:50 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/evcnt.h>
 
 #include <rump/rumpuser.h>
 
@@ -46,6 +47,22 @@
 static int giantcnt;
 static struct lwp *giantowner;
 
+static struct evcnt ev_biglock_fast;
+static struct evcnt ev_biglock_slow;
+static struct evcnt ev_biglock_recurse;
+
+void 
+rump_biglock_init(void)
+{
+
+       evcnt_attach_dynamic(&ev_biglock_fast, EVCNT_TYPE_MISC, NULL,
+           "rump biglock", "fast");
+       evcnt_attach_dynamic(&ev_biglock_slow, EVCNT_TYPE_MISC, NULL,
+           "rump biglock", "slow");
+       evcnt_attach_dynamic(&ev_biglock_recurse, EVCNT_TYPE_MISC, NULL,
+           "rump biglock", "recurse");
+}
+
 void
 rump_kernel_bigwrap(int *nlocks)
 {
@@ -74,11 +91,15 @@
                if (giantowner == l) {
                        giantcnt += nlocks;
                        nlocks = 0;
+                       ev_biglock_recurse.ev_count++;
                } else {
                        if (!rumpuser_mutex_tryenter(rump_giantlock)) {
                                rump_unschedule_cpu1(l, NULL);
                                rumpuser_mutex_enter_nowrap(rump_giantlock);
                                rump_schedule_cpu(l);
+                               ev_biglock_slow.ev_count++;
+                       } else {
+                               ev_biglock_fast.ev_count++;
                        }
                        giantowner = l;
                        giantcnt = 1;
diff -r 8bd69b524fad -r 2890836725c7 sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c  Tue Oct 09 10:25:44 2012 +0000
+++ b/sys/rump/librump/rumpkern/rump.c  Tue Oct 09 13:35:50 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump.c,v 1.246 2012/08/16 19:40:48 pgoyette Exp $      */
+/*     $NetBSD: rump.c,v 1.247 2012/10/09 13:35:50 pooka Exp $ */
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.246 2012/08/16 19:40:48 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.247 2012/10/09 13:35:50 pooka Exp $");
 
 #include <sys/systm.h>
 #define ELFSIZE ARCH_ELFSIZE
@@ -340,6 +340,8 @@
        lwpinit_specificdata();
        lwp_initspecific(&lwp0);
 
+       rump_biglock_init();
+
        rump_scheduler_init(numcpu);
        /* revert temporary context and schedule a semireal context */
        rumpuser_set_curlwp(NULL);
diff -r 8bd69b524fad -r 2890836725c7 sys/rump/librump/rumpkern/rump_private.h
--- a/sys/rump/librump/rumpkern/rump_private.h  Tue Oct 09 10:25:44 2012 +0000
+++ b/sys/rump/librump/rumpkern/rump_private.h  Tue Oct 09 13:35:50 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump_private.h,v 1.70 2011/03/21 16:41:09 pooka Exp $  */
+/*     $NetBSD: rump_private.h,v 1.71 2012/10/09 13:35:50 pooka Exp $  */
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -103,6 +103,7 @@
 struct lwp *   rump__lwproc_alloclwp(struct proc *);
 
 void   rump_cpus_bootstrap(int *);
+void   rump_biglock_init(void);
 void   rump_scheduler_init(int);
 void   rump_schedule(void);
 void   rump_unschedule(void);



Home | Main Index | Thread Index | Old Index