#ifndef _SYS_LOCKSTAT_H
#define _SYS_LOCKSTAT_H
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define LS_LCK_SPIN_LOCK_ACQUIRE 0
#define LS_LCK_SPIN_LOCK_SPIN 1
#define LS_LCK_SPIN_UNLOCK_RELEASE 2
#define LS_LCK_MTX_LOCK_ACQUIRE 3
#define LS_LCK_MTX_LOCK_BLOCK 5
#define LS_LCK_MTX_LOCK_SPIN 6
#define LS_LCK_MTX_LOCK_ILK_SPIN 7
#define LS_LCK_MTX_TRY_LOCK_ACQUIRE 8
#define LS_LCK_MTX_TRY_SPIN_LOCK_ACQUIRE 9
#define LS_LCK_MTX_UNLOCK_RELEASE 10
#define LS_LCK_MTX_LOCK_SPIN_ACQUIRE 39
#define LS_LCK_MTX_EXT_LOCK_ACQUIRE 17
#define LS_LCK_MTX_EXT_LOCK_BLOCK 18
#define LS_LCK_MTX_EXT_LOCK_SPIN 19
#define LS_LCK_MTX_EXT_LOCK_ILK_SPIN 20
#define LS_LCK_MTX_TRY_EXT_LOCK_ACQUIRE 21
#define LS_LCK_MTX_EXT_UNLOCK_RELEASE 22
#define LS_LCK_RW_LOCK_SHARED_ACQUIRE 23
#define LS_LCK_RW_LOCK_SHARED_BLOCK 24
#define LS_LCK_RW_LOCK_SHARED_SPIN 25
#define LS_LCK_RW_LOCK_EXCL_ACQUIRE 26
#define LS_LCK_RW_LOCK_EXCL_BLOCK 27
#define LS_LCK_RW_LOCK_EXCL_SPIN 28
#define LS_LCK_RW_DONE_RELEASE 29
#define LS_LCK_RW_TRY_LOCK_SHARED_ACQUIRE 30
#define LS_LCK_RW_TRY_LOCK_SHARED_SPIN 31
#define LS_LCK_RW_TRY_LOCK_EXCL_ACQUIRE 32
#define LS_LCK_RW_TRY_LOCK_EXCL_ILK_SPIN 33
#define LS_LCK_RW_LOCK_SHARED_TO_EXCL_UPGRADE 34
#define LS_LCK_RW_LOCK_SHARED_TO_EXCL_SPIN 35
#define LS_LCK_RW_LOCK_SHARED_TO_EXCL_BLOCK 36
#define LS_LCK_RW_LOCK_EXCL_TO_SHARED_DOWNGRADE 37
#define LS_LCK_RW_LOCK_EXCL_TO_SHARED_ILK_SPIN 38
#define LS_NPROBES 40
#define LS_LCK_MTX_LOCK "lck_mtx_lock"
#define LS_LCK_MTX_SPIN_LOCK "lck_mtx_spin_lock"
#define LS_LCK_MTX_UNLOCK "lck_mtx_unlock"
#define LS_LCK_MTX_TRY_LOCK "lck_mtx_try_lock"
#define LS_LCK_MTX_TRY_SPIN_LOCK "lck_mtx_try_spin_lock"
#define LS_LCK_MTX_EXT_LOCK "lck_mtx_ext_lock"
#define LS_LCK_MTX_EXT_UNLOCK "lck_mtx_ext_unlock"
#define LS_LCK_MTX_EXT_TRY_LOCK "lck_mtx_ext_try_lock"
#define LS_LCK_MTX_LOCK_SPIN_LOCK "lck_mtx_lock_spin"
#define LS_LCK_SPIN_LOCK "lck_spin_lock"
#define LS_LCK_SPIN_TRY_LOCK "lck_spin_try_lock"
#define LS_LCK_SPIN_UNLOCK "lck_spin_unlock"
#define LS_LCK_RW_LOCK_SHARED "lck_rw_lock_shared"
#define LS_LCK_RW_LOCK_EXCL "lck_rw_lock_exclusive"
#define LS_LCK_RW_DONE "lck_rw_done"
#define LS_LCK_RW_TRY_LOCK_EXCL "lck_rw_try_lock_exclusive"
#define LS_LCK_RW_TRY_LOCK_SHARED "lck_rw_try_lock_shared"
#define LS_LCK_RW_LOCK_SHARED_TO_EXCL "lck_rw_shared_to_exclusive"
#define LS_LCK_RW_LOCK_EXCL_TO_SHARED "lck_rw_exclusive_to_shared"
#define LS_ACQUIRE "acquire"
#define LS_RELEASE "release"
#define LS_SPIN "spin"
#define LS_BLOCK "block"
#define LS_UPGRADE "upgrade"
#define LS_DOWNGRADE "downgrade"
#define LS_TYPE_ADAPTIVE "adaptive"
#define LS_TYPE_SPIN "spin"
#define LS_TYPE_ILK "interlock"
#define LS_TYPE_THREAD "thread"
#define LS_TYPE_RW "rw"
#define LS_TYPE_RWUPGRADE "rwupgrade"
#define LSA_ACQUIRE (LS_TYPE_ADAPTIVE "-" LS_ACQUIRE)
#define LSA_RELEASE (LS_TYPE_ADAPTIVE "-" LS_RELEASE)
#define LSA_SPIN (LS_TYPE_ADAPTIVE "-" LS_SPIN)
#define LSA_BLOCK (LS_TYPE_ADAPTIVE "-" LS_BLOCK)
#define LSA_ILK_SPIN (LS_TYPE_ILK "-" LS_SPIN)
#define LSS_ACQUIRE (LS_TYPE_SPIN "-" LS_ACQUIRE)
#define LSS_RELEASE (LS_TYPE_SPIN "-" LS_RELEASE)
#define LSS_SPIN (LS_TYPE_SPIN "-" LS_SPIN)
#define LSR_ACQUIRE (LS_TYPE_RW "-" LS_ACQUIRE)
#define LSR_RELEASE (LS_TYPE_RW "-" LS_RELEASE)
#define LSR_BLOCK (LS_TYPE_RW "-" LS_BLOCK)
#define LSR_SPIN (LS_TYPE_RW "-" LS_SPIN)
#define LSR_UPGRADE (LS_TYPE_RW "-" LS_UPGRADE)
#define LSR_UPGRADE_BLOCK (LS_TYPE_RWUPGRADE "-" LS_BLOCK)
#define LSR_DOWNGRADE (LS_TYPE_RW "-" LS_DOWNGRADE)
#define LST_SPIN (LS_TYPE_THREAD "-" LS_SPIN)
#ifndef _ASM
#include <stdint.h>
#ifdef KERNEL
#ifndef _KERNEL
#define _KERNEL
#endif
#if defined(NEED_DTRACE_DEFS)
typedef uint32_t dtrace_id_t;
typedef uint64_t u_longlong_t;
#endif
extern dtrace_id_t lockstat_probemap[LS_NPROBES];
extern void (*lockstat_probe)(dtrace_id_t, uint64_t, uint64_t,
uint64_t, uint64_t, uint64_t);
#ifdef _KERNEL
#if CONFIG_DTRACE
#define LOCKSTAT_RECORD4(probe, lp, arg0, arg1, arg2, arg3) \
{ \
dtrace_id_t id; \
if ((id = lockstat_probemap[(probe)])) { \
(*lockstat_probe)(id, (uintptr_t)(lp), (arg0), \
(arg1), (arg2), (arg3)); \
} \
}
#define LOCKSTAT_RECORD2(probe, lp, arg1, arg2) \
LOCKSTAT_RECORD4(probe, lp, arg1, arg2, 0, 0)
#define LOCKSTAT_RECORD(probe, lp, arg) \
LOCKSTAT_RECORD4(probe, lp, arg, 0, 0, 0)
#define LOCKSTAT_RECORD0(probe, lp) \
LOCKSTAT_RECORD4(probe, lp, 0, 0, 0, 0)
#else
#define LOCKSTAT_RECORD()
#define LOCKSTAT_RECORD0()
#define LOCKSTAT_RECORD2()
#define LOCKSTAT_RECORD4()
#endif
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif