Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
Copyright 1989 AT&T
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 or http://www.opensolaris.org/os/licensing. 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]
#include <sys/types.h> #include <sys/ddi.h> clock_t drv_hztousec(clock_t hertz);
Architecture independent level 1 (DDI/DKI).
The number of clock ticks to convert.
The drv_hztousec() function converts into microseconds the time expressed by hertz, which is in system clock ticks.
The kernel variable lbolt, whose value should be retrieved by calling ddi_get_lbolt(9F), is the length of time the system has been up since boot and is expressed in clock ticks. Drivers often use the value of lbolt before and after an I/O request to measure the amount of time it took the device to process the request. The drv_hztousec() function can be used by the driver to convert the reading from clock ticks to a known unit of time.
The number of microseconds equivalent to the hertz parameter. No error value is returned. If the microsecond equivalent to hertz is too large to be represented as a clock_t, then the maximum clock_t value will be returned.
The drv_hztousec() function can be called from user, interrupt, or kernel context.
ddi_get_lbolt (9F), drv_usectohz (9F), drv_usecwait (9F)
Writing Device Drivers