2 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
3 .\" Copyright 1989 AT&T
4 .\" 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.
5 .\" 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.
6 .\" 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]
7 .TH DRV_HZTOUSEC 9F "Jan 16, 2006"
9 drv_hztousec \- convert clock ticks to microseconds
13 #include <sys/types.h>
18 \fBclock_t\fR \fBdrv_hztousec\fR(\fBclock_t\fR \fIhertz\fR);
24 Architecture independent level 1 (DDI/DKI).
32 The number of clock ticks to convert.
38 The \fBdrv_hztousec()\fR function converts into microseconds the time expressed
39 by \fIhertz\fR, which is in system clock ticks.
42 The kernel variable \fBlbolt\fR, whose value should be retrieved by calling
43 \fBddi_get_lbolt\fR(9F), is the length of time the system has been up since
44 boot and is expressed in clock ticks. Drivers often use the value of
45 \fBlbolt\fR before and after an \fBI/O\fR request to measure the amount of time
46 it took the device to process the request. The \fBdrv_hztousec()\fR function
47 can be used by the driver to convert the reading from clock ticks to a known
52 The number of microseconds equivalent to the \fIhertz\fR parameter. No error
53 value is returned. If the microsecond equivalent to \fIhertz\fR is too large to
54 be represented as a \fBclock_t\fR, then the maximum \fBclock_t\fR value will be
59 The \fBdrv_hztousec()\fR function can be called from user, interrupt, or kernel
64 \fBddi_get_lbolt\fR(9F), \fBdrv_usectohz\fR(9F), \fBdrv_usecwait\fR(9F)
67 \fIWriting Device Drivers\fR