]> git.saurik.com Git - apple/libc.git/blob - gen/times.3
Libc-763.11.tar.gz
[apple/libc.git] / gen / times.3
1 .\" Copyright (c) 1990, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\" @(#)times.3 8.1 (Berkeley) 6/4/93
33 .\" $FreeBSD: src/lib/libc/gen/times.3,v 1.10 2001/10/01 16:08:51 ru Exp $
34 .\"
35 .Dd June 4, 1993
36 .Dt TIMES 3
37 .Os
38 .Sh NAME
39 .Nm times
40 .Nd process times
41 .Sh LIBRARY
42 .Lb libc
43 .Sh SYNOPSIS
44 .In sys/times.h
45 .Ft clock_t
46 .Fo times
47 .Fa "struct tms *buffer"
48 .Fc
49 .Sh DESCRIPTION
50 .Bf -symbolic
51 This interface is obsoleted by
52 .Xr getrusage 2
53 and
54 .Xr gettimeofday 2 .
55 .Ef
56 .Pp
57 The
58 .Fn times
59 function returns the value of time in
60 .Dv CLK_TCK Ns 's
61 of a second since
62 0 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal
63 Time.
64 .Pp
65 It also fills in the structure pointed to by
66 .Fa buffer
67 with time-accounting information.
68 .Pp
69 The
70 .Vt tms
71 structure is defined as follows:
72 .Bd -literal -offset indent
73 struct tms {
74 clock_t tms_utime;
75 clock_t tms_stime;
76 clock_t tms_cutime;
77 clock_t tms_cstime;
78 };
79 .Ed
80 .Pp
81 The elements of this structure are defined as follows:
82 .Bl -tag -width ".Va tms_cutime"
83 .It Va tms_utime
84 The
85 .Tn CPU
86 time charged for the execution of user instructions.
87 .It Va tms_stime
88 The
89 .Tn CPU
90 time charged for execution by the system on behalf of
91 the process.
92 .It Va tms_cutime
93 The sum of the
94 .Va tms_utime Ns s
95 and
96 .Va tms_cutime Ns s
97 of the child processes.
98 .It Va tms_cstime
99 The sum of the
100 .Fa tms_stime Ns s
101 and
102 .Fa tms_cstime Ns s
103 of the child processes.
104 .El
105 .Pp
106 All times are in
107 .Dv CLK_TCK Ns 's
108 of a second.
109 .Pp
110 The times of a terminated child process are included in the
111 .Va tms_cutime
112 and
113 .Va tms_cstime
114 elements of the parent when one of the
115 .Xr wait 2
116 functions returns the process ID of the terminated child to the parent.
117 If an error occurs,
118 .Fn times
119 returns the value
120 .Pq Po Vt clock_t Pc Ns \-1 ,
121 and sets
122 .Va errno
123 to indicate the error.
124 .Sh ERRORS
125 The
126 .Fn times
127 function
128 may fail and set the global variable
129 .Va errno
130 for any of the errors specified for the library
131 routines
132 .Xr getrusage 2
133 and
134 .Xr gettimeofday 2 .
135 .Sh SEE ALSO
136 .Xr time 1 ,
137 .Xr getrusage 2 ,
138 .Xr gettimeofday 2 ,
139 .Xr wait 2 ,
140 .Xr clocks 7
141 .Sh STANDARDS
142 The
143 .Fn times
144 function
145 conforms to
146 .St -p1003.1-88 .