Commit | Line | Data |
---|---|---|
ae59e04c | 1 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. |
c66d0958 | 2 | .\" All rights reserved. |
43062420 | 3 | .\" |
c66d0958 | 4 | .\" %sccs.include.redist.man% |
43062420 | 5 | .\" |
ae59e04c | 6 | .\" @(#)times.3 6.4 (Berkeley) %G% |
c66d0958 | 7 | .\" |
ae59e04c CL |
8 | .Dd |
9 | .Dt TIMES 3 | |
10 | .Os BSD 4 | |
11 | .Sh NAME | |
12 | .Nm times | |
13 | .Nd process times | |
14 | .Sh SYNOPSIS | |
15 | .Fd #include <sys/times.h> | |
16 | .Ft clock_t | |
17 | .Fn times "struct tms *tp" | |
18 | .Sh DESCRIPTION | |
19 | .Bf -symbolic | |
20 | This interface is obsoleted by getrusage(2) | |
21 | and gettimeofday(3). | |
22 | .Ef | |
23 | .Pp | |
c66d0958 | 24 | The |
ae59e04c CL |
25 | .Fn times |
26 | function returns the value of time in | |
27 | .Dv CLK_TCK Ns 's | |
28 | of a second since | |
c66d0958 KB |
29 | 0 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal |
30 | Time. | |
ae59e04c | 31 | .Pp |
c66d0958 | 32 | It also fills in the structure pointed to by |
ae59e04c | 33 | .Fa tp |
c66d0958 | 34 | with time-accounting information. |
ae59e04c | 35 | .Pp |
c66d0958 | 36 | The |
ae59e04c | 37 | .Fa tms |
c66d0958 | 38 | structure is defined as follows: |
ae59e04c | 39 | .Bd -literal -offset indent |
c66d0958 | 40 | typedef struct { |
ae59e04c CL |
41 | clock_t tms_utime; |
42 | clock_t tms_stime; | |
43 | clock_t tms_cutime; | |
44 | clock_t tms_cstime; | |
c66d0958 | 45 | } |
ae59e04c CL |
46 | .Ed |
47 | .Pp | |
c66d0958 | 48 | The elements of this structure are defined as follows: |
ae59e04c CL |
49 | .Bl -tag -width tms_cutime |
50 | .It Fa tms_utime | |
51 | The | |
52 | .Tn CPU | |
53 | time charged for the execution of user instructions. | |
54 | .It Fa tms_stime | |
55 | The | |
56 | .Tn CPU | |
57 | time charged for execution by the system on behalf of | |
c66d0958 | 58 | the process. |
ae59e04c | 59 | .It Fa tms_cutime |
c66d0958 | 60 | The sum of the |
ae59e04c | 61 | .Fa tms_utime s |
c66d0958 | 62 | and |
ae59e04c | 63 | .Fa tms_cutime s |
c66d0958 | 64 | of the child processes. |
ae59e04c | 65 | .It Fa tms_cstime |
c66d0958 | 66 | The sum of the |
ae59e04c | 67 | .Fa tms_stime Ns s |
c66d0958 | 68 | and |
ae59e04c | 69 | .Fa tms_cstime Ns s |
c66d0958 | 70 | of the child processes. |
ae59e04c CL |
71 | .El |
72 | .Pp | |
73 | All times are in | |
74 | .Dv CLK_TCK Ns 's | |
75 | of a second. | |
76 | .Pp | |
c66d0958 | 77 | The times of a terminated child process are included in the |
ae59e04c | 78 | .Fa tms_cutime |
c66d0958 | 79 | and |
ae59e04c | 80 | .Fa tms_cstime |
c66d0958 | 81 | elements of the parent when one of the |
ae59e04c CL |
82 | .Xr wait 2 |
83 | functions returns the process ID of the terminated child to the parent. | |
c66d0958 | 84 | If an error occurs, |
ae59e04c CL |
85 | .Fn times |
86 | returns the value | |
87 | .Pq (clock_t)\-1 , | |
88 | and sets errno to indicate the error. | |
89 | .Sh ERRORS | |
90 | The | |
91 | .Fn times | |
92 | function | |
93 | may fail and set the global variable | |
94 | .Va errno | |
95 | for any of the errors specified for the library | |
c66d0958 | 96 | routines |
ae59e04c | 97 | .Xr getrusage 2 |
c66d0958 | 98 | and |
ae59e04c CL |
99 | .Xr gettimeofday 2 . |
100 | .Sh SEE ALSO | |
101 | .Xr time 1 , | |
102 | .Xr getrusage 2 , | |
103 | .Xr gettimeofday 2 , | |
104 | .Xr wait 2 | |
105 | .Sh STANDARDS | |
106 | The | |
107 | .Fn times | |
108 | function | |
109 | conforms to | |
110 | .St -p1003.1-88 . |