summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_rmlock.c
diff options
context:
space:
mode:
authorsson <sson@FreeBSD.org>2009-05-26 20:28:22 +0000
committersson <sson@FreeBSD.org>2009-05-26 20:28:22 +0000
commitc0d5996eb6885340017fa87726a787b38dfa689f (patch)
treeb7873baadff878509f8c7b930ddeeaa84074e546 /sys/kern/kern_rmlock.c
parent8dd898d24297058d22cfd3efb4da99431e21f707 (diff)
downloadFreeBSD-src-c0d5996eb6885340017fa87726a787b38dfa689f.zip
FreeBSD-src-c0d5996eb6885340017fa87726a787b38dfa689f.tar.gz
Add the OpenSolaris dtrace lockstat provider. The lockstat provider
adds probes for mutexes, reader/writer and shared/exclusive locks to gather contention statistics and other locking information for dtrace scripts, the lockstat(1M) command and other potential consumers. Reviewed by: attilio jhb jb Approved by: gnn (mentor)
Diffstat (limited to 'sys/kern/kern_rmlock.c')
-rw-r--r--sys/kern/kern_rmlock.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c
index 0a33c60..3d0a10d 100644
--- a/sys/kern/kern_rmlock.c
+++ b/sys/kern/kern_rmlock.c
@@ -35,6 +35,7 @@
__FBSDID("$FreeBSD$");
#include "opt_ddb.h"
+#include "opt_kdtrace.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -71,6 +72,9 @@ static __inline void compiler_memory_barrier(void) {
static void assert_rm(struct lock_object *lock, int what);
static void lock_rm(struct lock_object *lock, int how);
+#ifdef KDTRACE_HOOKS
+static int owner_rm(struct lock_object *lock, struct thread **owner);
+#endif
static int unlock_rm(struct lock_object *lock);
struct lock_class lock_class_rm = {
@@ -84,6 +88,9 @@ struct lock_class lock_class_rm = {
#endif
.lc_lock = lock_rm,
.lc_unlock = unlock_rm,
+#ifdef KDTRACE_HOOKS
+ .lc_owner = owner_rm,
+#endif
};
static void
@@ -107,6 +114,15 @@ unlock_rm(struct lock_object *lock)
panic("unlock_rm called");
}
+#ifdef KDTRACE_HOOKS
+static int
+owner_rm(struct lock_object *lock, struct thread **owner)
+{
+
+ panic("owner_rm called");
+}
+#endif
+
static struct mtx rm_spinlock;
MTX_SYSINIT(rm_spinlock, &rm_spinlock, "rm_spinlock", MTX_SPIN);
OpenPOWER on IntegriCloud