Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
times(3) Guardian Native C Library Calls Reference Manual
NAME
times - Gets process and child process times
LIBRARY
G-series native Guardian processes: system library
G-series native OSS processes: system library
H-series and J-series native Guardian processes: implicit libraries
H-series and J-series OSS processes: implicit libraries
SYNOPSIS
#include <sys/times.h>
clock_t times(
struct tms *buffer);
PARAMETERS
buffer Points to a type tms structure where system time information is to be stored.
DESCRIPTION
The times() function fills the type tms structure pointed to by the buffer parameter with time-
accounting information. All time values reported by this function are in clock ticks
(microseconds).
Time values are maintained only approximately:
• System time is the approximate time spent in OSS privileged code
• User time is the approximate time spent in OSS nonprivileged or user code.
Privileged operations are performed on behalf of application programs by the operating system;
nonprivileged operations are performed by application programs as well as by the operating sys-
tem. However, there is not a one-to-one relationship between OSS privileged/nonprivileged code
boundaries and the system/user code boundaries in a traditional UNIX system. System time also
can be consumed by underlying Guardian environment procedures that are outside Open System
Services.
If the cost of computing times is more than that of calling the function itself, times are not calcu-
lated for that function. In general, times are not repeatable because, for example, operations like
cache writebacks occur unpredictably and are charged to user processes.
The times of a terminated child process are included in the tms_cutime and tms_cstime ele-
ments of the parent process when a wait() or waitpid() function returns the process ID of that
terminated child. If a child process has not waited for its children, their times are not included in
its times.
The tms structure, which is defined in the sys/times.h header file, contains the following fields:
clock_t tms_utime
User time. The CPU time charged during execution of user instructions of the
calling process.
clock_t tms_stime
System time. The CPU time charged during system execution on behalf of the
calling process.
7−18 Hewlett-Packard Company 527192-018