summaryrefslogtreecommitdiffstats
path: root/sys/sys/mutex.h
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/sys/mutex.h
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/sys/mutex.h')
-rw-r--r--sys/sys/mutex.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h
index b069120..40795fc 100644
--- a/sys/sys/mutex.h
+++ b/sys/sys/mutex.h
@@ -40,6 +40,7 @@
#ifdef _KERNEL
#include <sys/pcpu.h>
#include <sys/lock_profile.h>
+#include <sys/lockstat.h>
#include <machine/atomic.h>
#include <machine/cpufunc.h>
#endif /* _KERNEL_ */
@@ -166,11 +167,11 @@ void _thread_lock_flags(struct thread *, int, const char *, int);
#ifndef _get_sleep_lock
#define _get_sleep_lock(mp, tid, opts, file, line) do { \
uintptr_t _tid = (uintptr_t)(tid); \
- if (!_obtain_lock((mp), _tid)) { \
+ if (!_obtain_lock((mp), _tid)) \
_mtx_lock_sleep((mp), _tid, (opts), (file), (line)); \
- } else \
- lock_profile_obtain_lock_success(&(mp)->lock_object, 0, \
- 0, (file), (line)); \
+ else \
+ LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_MTX_LOCK_ACQUIRE, \
+ mp, 0, 0, (file), (line)); \
} while (0)
#endif
@@ -193,8 +194,8 @@ void _thread_lock_flags(struct thread *, int, const char *, int);
_mtx_lock_spin((mp), _tid, (opts), (file), (line)); \
} \
} else \
- lock_profile_obtain_lock_success(&(mp)->lock_object, 0, \
- 0, (file), (line)); \
+ LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_MTX_SPIN_LOCK_ACQUIRE, \
+ mp, 0, 0, (file), (line)); \
} while (0)
#else /* SMP */
#define _get_spin_lock(mp, tid, opts, file, line) do { \
@@ -240,7 +241,8 @@ void _thread_lock_flags(struct thread *, int, const char *, int);
if (mtx_recursed((mp))) \
(mp)->mtx_recurse--; \
else { \
- lock_profile_release_lock(&(mp)->lock_object); \
+ LOCKSTAT_PROFILE_RELEASE_LOCK(LS_MTX_SPIN_UNLOCK_RELEASE, \
+ mp); \
_release_lock_quick((mp)); \
} \
spinlock_exit(); \
OpenPOWER on IntegriCloud