1drv_hztousec(9F)         Kernel Functions for Drivers         drv_hztousec(9F)
2
3
4

NAME

6       drv_hztousec - convert clock ticks to microseconds
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <sys/ddi.h>
11
12
13
14       clock_t drv_hztousec(clock_t hertz);
15
16

INTERFACE LEVEL

18       Architecture independent level 1 (DDI/DKI).
19

PARAMETERS

21       hertz    The number of clock ticks to convert.
22
23

DESCRIPTION

25       The   drv_hztousec()  function  converts  into  microseconds  the  time
26       expressed by hertz, which is in system clock ticks.
27
28
29       The kernel variable lbolt, whose value should be retrieved  by  calling
30       ddi_get_lbolt(9F),  is  the length of time the system has been up since
31       boot and is expressed in clock ticks. Drivers often use  the  value  of
32       lbolt  before and after an I/O request to measure the amount of time it
33       took the device to process the request. The drv_hztousec() function can
34       be  used  by  the  driver  to convert the reading from clock ticks to a
35       known unit of time.
36

RETURN VALUES

38       The number of microseconds equivalent to the hertz parameter. No  error
39       value  is returned. If the microsecond equivalent to hertz is too large
40       to be represented as a clock_t, then the maximum clock_t value will  be
41       returned.
42

CONTEXT

44       The drv_hztousec() function can be called from user, interrupt, or ker‐
45       nel context.
46

SEE ALSO

48       ddi_get_lbolt(9F), drv_usectohz(9F), drv_usecwait(9F)
49
50
51       Writing Device Drivers
52
53
54
55SunOS 5.11                        16 Jan 2006                 drv_hztousec(9F)
Impressum