Source-Changes-HG archive

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

[src/trunk]: src/external/cddl/osnet/dev/lockstat keep track of the number of...



details:   https://anonhg.NetBSD.org/src/rev/8d51cf0552ba
branches:  trunk
changeset: 336663:8d51cf0552ba
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Mar 09 01:42:26 2015 +0000

description:
keep track of the number of enabled probes and set the lockstat_dtrace_enabled
flag appropriately.

diffstat:

 external/cddl/osnet/dev/lockstat/lockstat.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (57 lines):

diff -r 9b14354439ae -r 8d51cf0552ba external/cddl/osnet/dev/lockstat/lockstat.c
--- a/external/cddl/osnet/dev/lockstat/lockstat.c       Mon Mar 09 01:41:41 2015 +0000
+++ b/external/cddl/osnet/dev/lockstat/lockstat.c       Mon Mar 09 01:42:26 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lockstat.c,v 1.7 2015/03/09 01:07:27 riastradh Exp $   */
+/*     $NetBSD: lockstat.c,v 1.8 2015/03/09 01:42:26 christos Exp $    */
 
 /*
  * CDDL HEADER START
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lockstat.c,v 1.7 2015/03/09 01:07:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lockstat.c,v 1.8 2015/03/09 01:42:26 christos Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -38,6 +38,7 @@
 #include <sys/xcall.h>
 #include <sys/atomic.h>
 
+#define NLOCKSTAT 1
 #include <dev/lockstat.h>
 
 #define        ASSERT  KASSERT
@@ -62,6 +63,7 @@
 };
 
 static dtrace_provider_id_t lockstat_id;
+static size_t lockstat_dtrace_count;
 
 /*ARGSUSED*/
 static int
@@ -72,6 +74,10 @@
        ASSERT(!lockstat_probemap[LS_COMPRESS(probe->lsp_probe)]);
 
        lockstat_probemap[LS_COMPRESS(probe->lsp_probe)] = id;
+       if (lockstat_dtrace_count++ == 0) {
+               lockstat_dtrace_enabled = LB_DTRACE;
+               LOCKSTAT_ENABLED_UPDATE();
+       }
 
        return 0;
 }
@@ -84,6 +90,11 @@
 
        ASSERT(lockstat_probemap[LS_COMPRESS(probe->lsp_probe)]);
 
+       if (--lockstat_dtrace_count == 0) {
+               lockstat_dtrace_enabled = 0;
+               LOCKSTAT_ENABLED_UPDATE();
+       }
+
        lockstat_probemap[LS_COMPRESS(probe->lsp_probe)] = 0;
 }
 



Home | Main Index | Thread Index | Old Index