clock_impl.h revision 1b7f7204f8aa806a57b84cdeba100d819be85a61
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_CLOCK_IMPL_H
#define _SYS_CLOCK_IMPL_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Default clock rate in Hz.
*/
#define HZ_DEFAULT 100
/*
* Thresholds over which we switch between event and cyclic driven lbolt. The
* current default values were derived experimentally and will keep the
* system on event driven mode when idle and respond to activity around the
* lbolt DDI functions by switching to cyclic mode.
*/
#define LBOLT_THRESH_CALLS (75)
#define LBOLT_THRESH_INTERVAL (1)
/*
* Both lbolt_cpu_t and lbolt_info_t are cache line sized and aligned,
* please take that in consideration if modifying these.
*/
typedef struct lbolt_cpu {
} lbolt_cpu_t;
typedef struct lbolt_info {
} lbolt_info_t;
extern int64_t lbolt_event_driven(void);
extern int64_t lbolt_cyclic_driven(void);
extern int64_t (*lbolt_hybrid)(void);
extern void lbolt_softint_add(void);
extern void lbolt_softint_post(void);
extern void lbolt_debug_entry(void);
extern void lbolt_debug_return(void);
extern lbolt_info_t *lb_info;
/*
* LBOLT_WAITFREE{,64} provide a non-waiting version of lbolt.
*/
#define LBOLT_WAITFREE64 \
(lbolt_hybrid == lbolt_event_driven ? \
((gethrtime_waitfree()/nsec_per_tick) - \
lb_info->lbi_debug_time) : \
/*
* LBOLT_FASTPATH{,64} should *only* be used where the cost of calling the
* DDI lbolt routines affects performance. This is currently only used by
*/
#define LBOLT_FASTPATH64 \
/*
* LBOLT_NO_ACCOUNT{,64} is used by lbolt consumers who fire at a periodic
* rate, such as clock(), for which the lbolt usage statistics are not updated.
* This is especially important for consumers whose rate may be modified by
* the user, resulting in an unaccounted for increase in activity around the
* lbolt routines that could cause a mode switch.
*/
#define LBOLT_NO_ACCOUNT64 \
(lbolt_hybrid == lbolt_event_driven ? \
#endif /* _KERNEL || _KMEMUSER */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_CLOCK_IMPL_H */