gno/usr.man/man2/times.2

129 lines
3.6 KiB
Groff

.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)times.3 8.1 (Berkeley) 6/4/93
.\"
.TH TIMES 2 "16 January 1997" GNO "System Calls"
.SH NAME
.BR times
\- process times
.SH SYNOPSIS
.br
#include <sys/times.h>
.sp 1
clock_t
times (struct tms *tp);
.SH DESCRIPTION
The
.BR times
function returns the value of time in
.BR CLK_TCK 's
of a second since
0 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal
Time.
.LP
It also fills in the structure pointed to by
.I tp
with time-accounting information.
.LP
The
.I tms
structure is defined as follows:
.nf
typedef struct {
clock_t tms_utime;
clock_t tms_stime;
clock_t tms_cutime;
clock_t tms_cstime;
}
.fi
.LP
The elements of this structure are defined as follows:
.RS
.IP \fItms_utime\fR
The CPU time charged for the execution of user instructions.
.IP \fItms_stime\fR
The CPU time charged for execution by the system on behalf of
the process.
.IP \fItms_cutime\fR
The sum of the
.IR tms_utime ,
and
.IR tms_cutime
of the child processes.
.IP \fItms_cstime\fR
The sum of the
.IR tms_stime ,
and
.IR tms_cstime
of the child processes.
.RE
.LP
All times are in
.BR CLK_TCK 's
of a second.
.LP
The times of a terminated child process are included in the
.I tms_cutime
and
.I tms_cstime
elements of the parent when one of the
.BR wait (2)
functions returns the process ID of the terminated child to the parent.
If an error occurs,
.BR times
returns the value
.BR (clock_t)\-1 ,
and sets errno to indicate the error.
.SH ERRORS
The
.BR times
function
may fail and set the global variable
.IR errno
for any of the errors specified for the library
routines
.BR getrusage (2)
and
.BR gettimeofday (2).
.SH SEE ALSO
.BR time (1),
.BR getrusage (2),
.BR gettimeofday (2),
.BR wait (2),
.BR clocks (7)
.SH STANDARDS
The
.BR times
function
conforms to POSIX 1003.1-88.