timeout(9r)timeout(9r)NAME
timeout - General: Initializes a callout queue element
SYNOPSIS
void timeout(
int (*function) (),
caddr_t argument,
register int time );
ARGUMENTS
Specifies a pointer to the routine to be called. Specifies a single argument to be passed to the called routine. Specifies the amount of
time to delay before calling the specified routine. You express time as time (in seconds) * hz.
DESCRIPTION
The timeout routine initializes a callout queue element to make it easy to execute the specified routine at the time specified in the time
argument. You often use callout routines for infrequent polling or error handling. The routine you specify will be called on the interrupt
stack (not in processor context) as dispatched from the softclock routine.
The global variable hz contains the number of clock ticks per second. This variable is a second's worth of clock ticks.
Thus, if you wanted a 4-minute timeout, you would pass 4 * 60 * hz as the third argument to the timeout routine as follows:
/* A 4-minute timeout */
.
.
.
timeout(lptout, (caddr_t)dev, 4 * 60 * hz);
NOTES
The granularity of the time delay is dependent on the hardware. For example, the granularity of some Alpha CPUs is 1024 clock ticks per
second. Other Alpha CPUs have a granularity of 1200 clock ticks per second. Still other Alpha CPUs exhibit a granularity of 128 clock
ticks per second. Because the granularity of the time delay is dependent on the hardware, the operating system provides the hz and lbolt
global variables. Use the hz global variable to determine the number of clock ticks per second for a specific Alpha CPU. Use the lbolt
global variable as a periodic wakeup mechanism.
RETURN VALUES
None
SEE ALSO
Routines: untimeout(9r)timeout(9r)
Check Out this Related Man Page
drv_usectohz(9F) Kernel Functions for Drivers drv_usectohz(9F)NAME
drv_usectohz - convert microseconds to clock ticks
SYNOPSIS
#include <sys/types.h>
#include <sys/ddi.h>
clock_t drv_usectohz(clock_t microsecs);
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI).
PARAMETERS
microsecs The number of microseconds to convert.
DESCRIPTION
drv_usectohz() converts a length of time expressed in microseconds to a number of system clock ticks. The time arguments to timeout(9F)
and delay(9F) are expressed in clock ticks.
drv_usectohz() is a portable interface for drivers to make calls to timeout(9F) and delay(9F) and remain binary compatible should the
driver object file be used on a system with a different clock speed (a different number of ticks in a second).
RETURN VALUES
The value returned is the number of system clock ticks equivalent to the microsecs argument. No error value is returned. If the clock
tick equivalent to microsecs is too large to be represented as a clock_t, then the maximum clock_t value will be returned.
CONTEXT
drv_usectohz() can be called from user or interrupt context.
SEE ALSO delay(9F), drv_hztousec(9F), timeout(9F)
Writing Device Drivers
SunOS 5.10 12 Nov 1992 drv_usectohz(9F)
Hey all,
i need a program to get the CPU ticks at certain points of my program. So, i thought about using the clock function, but i'm having a hard time figuring out how it really works. I wrote this simple program to try to understand it but it made me feel more confused:
#include <stdio.h>... (5 Replies)
Hi ,
I have three funcions f1, f2 and f3 .
f1 calls f2 and f2 calls f3 .
I have a global variable "period" which i want to pass to f3 .
Can i pass the variable directly in the definition of f3 ?
Pls help .
sars (4 Replies)
I have a text file called 'tomcat_temp_out'.
I want to get only last 5 minute worth of data from this file and redirect those data into another fule.
Could you please help to work on this? (2 Replies)
I'm accessing the TSC register, and using usleep() function to calculate my clock frequency. Basically, I check the current clock, delay for 1 second, and then check the clock again to discover how many clock ticks occur in a second.
The only problem is - my result turns out to be a... (1 Reply)
Hi,
I have a file containing timestamps (at micro-seconds granularity). It looks like the following:
06:49:42.383818
06:49:42.390190
06:49:42.392308
06:49:42.392712
06:49:42.393437
06:49:42.393960
06:49:42.402115
Now I need a sed/awk script to take the difference of two successive... (2 Replies)