summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_lockstat.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_lockstat.c')
-rw-r--r--sys/kern/kern_lockstat.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/kern/kern_lockstat.c b/sys/kern/kern_lockstat.c
index 1f35893..3a65fa9 100644
--- a/sys/kern/kern_lockstat.c
+++ b/sys/kern/kern_lockstat.c
@@ -36,9 +36,10 @@
#ifdef KDTRACE_HOOKS
-#include <sys/time.h>
#include <sys/types.h>
+#include <sys/lock.h>
#include <sys/lockstat.h>
+#include <sys/time.h>
/*
* The following must match the type definition of dtrace_probe. It is
@@ -47,14 +48,19 @@
uint32_t lockstat_probemap[LS_NPROBES];
void (*lockstat_probe_func)(uint32_t, uintptr_t, uintptr_t,
uintptr_t, uintptr_t, uintptr_t);
-
+int lockstat_enabled = 0;
uint64_t
-lockstat_nsecs(void)
+lockstat_nsecs(struct lock_object *lo)
{
struct bintime bt;
uint64_t ns;
+ if (!lockstat_enabled)
+ return (0);
+ if ((lo->lo_flags & LO_NOPROFILE) != 0)
+ return (0);
+
binuptime(&bt);
ns = bt.sec * (uint64_t)1000000000;
ns += ((uint64_t)1000000000 * (uint32_t)(bt.frac >> 32)) >> 32;
OpenPOWER on IntegriCloud