| 1 | .\" Copyright (c) 1980 Regents of the University of California.
 | 
|---|
| 2 | .\" All rights reserved.  The Berkeley software License Agreement
 | 
|---|
| 3 | .\" specifies the terms and conditions for redistribution.
 | 
|---|
| 4 | .\"
 | 
|---|
| 5 | .\"     @(#)times.3c    6.1 (Berkeley) 5/9/85
 | 
|---|
| 6 | .\"
 | 
|---|
| 7 | .TH TIMES 2 "May 9, 1985"
 | 
|---|
| 8 | .UC 4
 | 
|---|
| 9 | .SH NAME
 | 
|---|
| 10 | times \- get process times
 | 
|---|
| 11 | .SH SYNOPSIS
 | 
|---|
| 12 | .nf
 | 
|---|
| 13 | .ft B
 | 
|---|
| 14 | #include <sys/types.h>
 | 
|---|
| 15 | #include <sys/times.h>
 | 
|---|
| 16 | #include <time.h>
 | 
|---|
| 17 | 
 | 
|---|
| 18 | int times(struct tms *\fIbuffer\fP)
 | 
|---|
| 19 | .fi
 | 
|---|
| 20 | .SH DESCRIPTION
 | 
|---|
| 21 | .B Times
 | 
|---|
| 22 | returns time-accounting information
 | 
|---|
| 23 | for the current process
 | 
|---|
| 24 | and for the terminated child processes
 | 
|---|
| 25 | of the current process.
 | 
|---|
| 26 | All times are in 1/CLOCKS_PER_SEC seconds.
 | 
|---|
| 27 | .PP
 | 
|---|
| 28 | This is the structure returned by
 | 
|---|
| 29 | .BR times :
 | 
|---|
| 30 | .PP
 | 
|---|
| 31 | .RS
 | 
|---|
| 32 | .nf
 | 
|---|
| 33 | .ta +0.4i +0.8i +1.2i
 | 
|---|
| 34 | struct tms {
 | 
|---|
| 35 |         clock_t tms_utime;      /* user time for this process */
 | 
|---|
| 36 |         clock_t tms_stime;      /* system time for this process */
 | 
|---|
| 37 |         clock_t tms_cutime;     /* children's user time */
 | 
|---|
| 38 |         clock_t tms_cstime;     /* children's system time */
 | 
|---|
| 39 | };
 | 
|---|
| 40 | .fi
 | 
|---|
| 41 | .RE
 | 
|---|
| 42 | .PP
 | 
|---|
| 43 | The user time is the number of clock ticks used by a process on
 | 
|---|
| 44 | its own computations.  The system time is the number of clock ticks
 | 
|---|
| 45 | spent inside the kernel on behalf of a process.  This does not
 | 
|---|
| 46 | include time spent waiting for I/O to happen, only actual CPU
 | 
|---|
| 47 | instruction times.
 | 
|---|
| 48 | .PP
 | 
|---|
| 49 | The children times are the sum
 | 
|---|
| 50 | of the children's process times and
 | 
|---|
| 51 | their children's times.
 | 
|---|
| 52 | .SH RETURN
 | 
|---|
| 53 | .B Times
 | 
|---|
| 54 | returns 0 on success, otherwise \-1 with the error code stored into the
 | 
|---|
| 55 | global variable
 | 
|---|
| 56 | .BR errno .
 | 
|---|
| 57 | .SH ERRORS
 | 
|---|
| 58 | The following error code may be set in
 | 
|---|
| 59 | .BR errno :
 | 
|---|
| 60 | .TP 15
 | 
|---|
| 61 | [EFAULT]
 | 
|---|
| 62 | The address specified by the
 | 
|---|
| 63 | .I buffer
 | 
|---|
| 64 | parameter is not in a valid part of the process address space.
 | 
|---|
| 65 | .SH "SEE ALSO"
 | 
|---|
| 66 | .BR time (1),
 | 
|---|
| 67 | .BR wait (2),
 | 
|---|
| 68 | .BR time (2).
 | 
|---|