/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_LOCKSTAT_H
#define _SYS_LOCKSTAT_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#define LS_MUTEX_ENTER_ACQUIRE 0
#ifndef _ASM
#include <sys/inttypes.h>
#ifdef _KERNEL
/*
* Platform-independent kernel support for the lockstat driver.
*/
extern int lockstat_active_threads(void);
extern int lockstat_depth(void);
extern void lockstat_hot_patch(void);
/*
* Macros to record lockstat probes.
*/
/* used for 32 bit systems to avoid overflow */
#if defined(_ILP32)
#else
#define CLAMP32(x) (x)
#endif
if (lockstat_probemap[(probe)]) { \
dtrace_id_t id; \
curthread->t_lockstat++; \
membar_enter(); \
curthread->t_lockstat--; \
}
/*
* Return timestamp for start of busy-waiting (for spin probes)
*/
)
/*
* Record elapsed time since LOCKSTAT_START_TIME was called if the
* probe is enabled at start and end, else return 0. t_start must
* be the value returned by LOCKSTAT_START_TIME.
*/
if (lockstat_probemap[(probe)]) { \
dtrace_id_t id; \
curthread->t_lockstat++; \
membar_enter(); \
if (t_spin) { \
} \
0, 0, 0); \
} \
curthread->t_lockstat--; \
}
#endif /* _KERNEL */
#endif /* _ASM */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_LOCKSTAT_H */