Kernel Functions for Drivers drvhztousec(9F)
NAME
drvhztousec - convert clock ticks to microseconds
SYNOPSIS
#include
#include
clockt drvhztousec(clockt hertz);
INTERFACE LEVEL
Architecture independent level 1 (DI/DKI).
PARAMETERS
hertz The number of clock ticks to convert.
DESCRIPTION
The drvhztousec() 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 ddigetlbolt(9F), is the length of time the sys-
tem 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 drvhztousec() function can be used
by the driver to convert the reading from clock ticks to a
known unit of time.
RETURN VALUES
The number of microseconds equivalent to the hertz parame-
ter. No error value is returned. If the microsecond
equivalent to hertz is too large to be represented as a
clockt, then the maximum clockt value will be returned.
CONTEXT
The drvhztousec() function can be called from user, inter-
rupt, or kernel context.
SEE ALSO
ddigetlbolt(9F), drvusectohz(9F), drvusecwait(9F)
Writing Device Drivers
SunOS 5.11 Last change: 16 Jan 2006 1
|