hpux man page for gethrtime

Query: gethrtime

OS: hpux

Section: 3c

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

gethrtime(3C)															     gethrtime(3C)

NAME
gethrtime() - get high resolution time
SYNOPSIS
DESCRIPTION
The function returns the current high-resolution real time. Time is expressed as nanoseconds since a certain time in the past. This API uses a fast light weight system call to get the nanoseconds from a certain time. It is not correlated in any way to the time of day. This API is used for performance measurement tasks and is used for cheap and accurate interval timing. is a signed 64-bit number.
RETURN VALUE
Upon successful completion, returns a number of nanoseconds. Otherwise, a value of -1 is returned.
WARNINGS
This API will only be available if the application is being compiled in -Ae mode (extended ANSI) because 64-bit integer numbers are not available in -Aa (ANSI) mode. Please refer to cc(1).
EXAMPLES
The following code fragment measures the average cost of hrtime_t begin, end; int i, count = 1000; begin = gethrtime(); for (i = 0; i < count; i++) getgid(); end = gethrtime(); printf("Avg getgid() time = %lld nsec", (end - begin)/count ); gethrtime(3C)
Related Man Pages
gethrvtime(3c) - sunos
gethrtime(3c) - mojave
gethrtime(3c) - x11r4
gethrtime(3c) - v7
gethrtime(3c) - minix
Similar Topics in the Unix Linux Community
Use of alloca function
Measure thread execution (in C, unix)
Tool to simulate non-sequential disk I/O (simulate db file sequential read) in C POSIX
lightweight function for measuring time ( better than clock_getime )