iticks.3c (2010 09)
i
iticks(3C) iticks(3C)
NAME
iticks: iticks_gettimes(), iticks_to_timespec(), iticks_to_hrtime() - get instantaneous thread time consump-
tion statistics
SYNOPSIS
#include <iticks.h>
void iticks_gettimes(iticks_t *user, iticks_t *system,
iticks_t *interrupt, iticks_t *real);
struct timespec iticks_to_timespec(iticks_t iticks);
hrtime_t iticks_to_hrtime(iticks_t iticks);
DESCRIPTION
iticks_gettimes()
provides a fast and accurate method to measure intervals of virtual and/or real
time consumed by the caller.
iticks_gettimes
iticks_gettimes()
can get several time statistics in a single call, with these arguments:
user The user time consumed by the calling thread. If not NULL, is expressed in
machine-dependent interval timer ticks, and stored in the location pointed to by the
argument user .
system The system time consumed by the calling thread. If not NULL, is expressed in
machine-dependent interval timer ticks, and stored in the location pointed to by the
argument system .
interrupt The interrupt time consumed by the calling thread. If not NULL, is expressed in
machine-dependent interval timer ticks, and stored in the location pointed to by the
argument interrupt .
real The time since the system boot time. If not NULL, is expressed in machine-dependent
interval timer ticks, and stored in the location pointed to by the argument real .
iticks_to_timespec
Converts machine-dependent interval timer ticks into a machine-independent
struct timespec.
iticks_to_hrtime
Converts machine-dependent interval timer ticks into a machine-independent high-resolution
hrtime_t.
Application Usage
An approximation of the time of day may be calculated by converting a real value to
struct timespec
and adding the boot time (in seconds) to the tv_sec field of struct timespec. The boot time (in
seconds) is available via the pstat_getstatic()
call, see pstat_getstatic(2).
Note that due to differences between this method and that used by the operating system to keep an accu-
rate time of day, the results may differ noticeably from values returned by
time() or gettimeof-
day(), see time (2) and gettimeofday (2).
To use any of these functions, make sure your program links in the
libcEnh library by specifying
-lcEnh on the compiler or linker command line.
RETURN VALUE
iticks_gettimes() does not return a value.
ERRORS
No error conditions are defined.
WARNINGS
The virtual times returned by
iticks_gettimes() reflect the calling thread only and do not include
time consumed by other threads in the calling process or child processes.
The conversion from machine-dependent units to machine-independent units is, naturally, machine-
dependent. If you move times in iticks_t units from one machine to another, the results of any subse-
quent conversions to machine-independent units are undefined.
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1