GETUSCLK(3)

NAME
getusclk, usclk_init - get/init microsecond clock

SYNOPSIS
C syntax:

	#include <usclkc.h>
	void usclk_init()

	usclk_t getusclk()

FORTRAN syntax:

	$INCLUDE /usr/include/usclkf.h
	subroutine usclk_init()

	integer*4 function getusclk()

Pascal syntax:

	{$I /usr/include/usclkp.h}
	procedure usclk_init;
	cexternal;

	function getusclk : longint;
	cexternal;

DESCRIPTION
The Sequent microsecond clock (usclk) is a programmatically accessible 32-bit up-counter which increments in real (wall clock) time at a one microsecond per tick rate. It is reset to zero at power-up and free runs thereafter. There is no notification as the clock rolls over its maximum value and returns to zero.

Usclk_init maps the microsecond clock into process address space, making it accessible for subsequent use. Usclk_init should be called only once and must precede the first call to getusclk .

Getusclk returns the current 32-bit microsecond clock value.

The routines described here are in /usr/lib/libseq.a. They are linked into a program using the -lseq option in the cc, fortran, pascal, or ld command line. See the /usr/sequent/usclk.demo directory for sample usage.

NOTES
The mapping established by usclk_init is inherited by forked processes.

The call overhead for getusclk is almost nil on Symmetry, approximately 25 microseconds on Balance.

DIAGNOSTICS
Usclk_init fails with exit status 1 if it cannot open, map, or access the microsecond clock device.

On Balance, a SIGBUS access error signal is delivered if the microsecond clock device is improperly accessed (this cannot happen if getusclk(3) is used).

SEE ALSO
getitimer(2), gettimeofday(2)

BUGS
(Balance only.) A slight chance exists that a user-mode program making an improper access to the microsecond clock device will cause a DYNIX panic. No panic occurs if the device is accessed exclusively with the software interfaces provided for it.