1*48352Scael.\" Copyright (c) 1990, 1991 The Regents of the University of California. 245145Sbostic.\" All rights reserved. 320174Smckusick.\" 445145Sbostic.\" %sccs.include.redist.man% 520174Smckusick.\" 6*48352Scael.\" @(#)times.3 6.4 (Berkeley) 04/19/91 745145Sbostic.\" 8*48352Scael.Dd 9*48352Scael.Dt TIMES 3 10*48352Scael.Os BSD 4 11*48352Scael.Sh NAME 12*48352Scael.Nm times 13*48352Scael.Nd process times 14*48352Scael.Sh SYNOPSIS 15*48352Scael.Fd #include <sys/times.h> 16*48352Scael.Ft clock_t 17*48352Scael.Fn times "struct tms *tp" 18*48352Scael.Sh DESCRIPTION 19*48352Scael.Bf -symbolic 20*48352ScaelThis interface is obsoleted by getrusage(2) 21*48352Scaeland gettimeofday(3). 22*48352Scael.Ef 23*48352Scael.Pp 2445145SbosticThe 25*48352Scael.Fn times 26*48352Scaelfunction returns the value of time in 27*48352Scael.Dv CLK_TCK Ns 's 28*48352Scaelof a second since 2945145Sbostic0 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal 3045145SbosticTime. 31*48352Scael.Pp 3245145SbosticIt also fills in the structure pointed to by 33*48352Scael.Fa tp 3445145Sbosticwith time-accounting information. 35*48352Scael.Pp 3645145SbosticThe 37*48352Scael.Fa tms 3845145Sbosticstructure is defined as follows: 39*48352Scael.Bd -literal -offset indent 4045145Sbostictypedef struct { 41*48352Scael clock_t tms_utime; 42*48352Scael clock_t tms_stime; 43*48352Scael clock_t tms_cutime; 44*48352Scael clock_t tms_cstime; 4545145Sbostic} 46*48352Scael.Ed 47*48352Scael.Pp 4845145SbosticThe elements of this structure are defined as follows: 49*48352Scael.Bl -tag -width tms_cutime 50*48352Scael.It Fa tms_utime 51*48352ScaelThe 52*48352Scael.Tn CPU 53*48352Scaeltime charged for the execution of user instructions. 54*48352Scael.It Fa tms_stime 55*48352ScaelThe 56*48352Scael.Tn CPU 57*48352Scaeltime charged for execution by the system on behalf of 5845145Sbosticthe process. 59*48352Scael.It Fa tms_cutime 6045145SbosticThe sum of the 61*48352Scael.Fa tms_utime s 6245145Sbosticand 63*48352Scael.Fa tms_cutime s 6445145Sbosticof the child processes. 65*48352Scael.It Fa tms_cstime 6645145SbosticThe sum of the 67*48352Scael.Fa tms_stime Ns s 6845145Sbosticand 69*48352Scael.Fa tms_cstime Ns s 7045145Sbosticof the child processes. 71*48352Scael.El 72*48352Scael.Pp 73*48352ScaelAll times are in 74*48352Scael.Dv CLK_TCK Ns 's 75*48352Scaelof a second. 76*48352Scael.Pp 7745145SbosticThe times of a terminated child process are included in the 78*48352Scael.Fa tms_cutime 7945145Sbosticand 80*48352Scael.Fa tms_cstime 8145145Sbosticelements of the parent when one of the 82*48352Scael.Xr wait 2 83*48352Scaelfunctions returns the process ID of the terminated child to the parent. 8445145SbosticIf an error occurs, 85*48352Scael.Fn times 86*48352Scaelreturns the value 87*48352Scael.Pq (clock_t)\-1 , 88*48352Scaeland sets errno to indicate the error. 89*48352Scael.Sh ERRORS 90*48352ScaelThe 91*48352Scael.Fn times 92*48352Scaelfunction 93*48352Scaelmay fail and set the global variable 94*48352Scael.Va errno 95*48352Scaelfor any of the errors specified for the library 9645145Sbosticroutines 97*48352Scael.Xr getrusage 2 9845145Sbosticand 99*48352Scael.Xr gettimeofday 2 . 100*48352Scael.Sh SEE ALSO 101*48352Scael.Xr time 1 , 102*48352Scael.Xr getrusage 2 , 103*48352Scael.Xr gettimeofday 2 , 104*48352Scael.Xr wait 2 105*48352Scael.Sh STANDARDS 106*48352ScaelThe 107*48352Scael.Fn times 108*48352Scaelfunction 109*48352Scaelconforms to 110*48352Scael.St -p1003.1-88 . 111