xref: /csrg-svn/lib/libc/gen/times.3 (revision 61111)
1*61111Sbostic.\" Copyright (c) 1990, 1991, 1993
2*61111Sbostic.\"	The Regents of the University of California.  All rights reserved.
320174Smckusick.\"
445145Sbostic.\" %sccs.include.redist.man%
520174Smckusick.\"
6*61111Sbostic.\"     @(#)times.3	8.1 (Berkeley) 06/04/93
745145Sbostic.\"
848352Scael.Dd
948352Scael.Dt TIMES 3
1048352Scael.Os BSD 4
1148352Scael.Sh NAME
1248352Scael.Nm times
1348352Scael.Nd process times
1448352Scael.Sh SYNOPSIS
1548352Scael.Fd #include <sys/times.h>
1648352Scael.Ft clock_t
1748352Scael.Fn times "struct tms *tp"
1848352Scael.Sh DESCRIPTION
1948352Scael.Bf -symbolic
2048352ScaelThis interface is obsoleted by getrusage(2)
2148352Scaeland gettimeofday(3).
2248352Scael.Ef
2348352Scael.Pp
2445145SbosticThe
2548352Scael.Fn times
2648352Scaelfunction returns the value of time in
2748352Scael.Dv CLK_TCK Ns 's
2848352Scaelof a second since
2945145Sbostic0 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal
3045145SbosticTime.
3148352Scael.Pp
3245145SbosticIt also fills in the structure pointed to by
3348352Scael.Fa tp
3445145Sbosticwith time-accounting information.
3548352Scael.Pp
3645145SbosticThe
3748352Scael.Fa tms
3845145Sbosticstructure is defined as follows:
3948352Scael.Bd -literal -offset indent
4045145Sbostictypedef struct {
4148352Scael	clock_t tms_utime;
4248352Scael	clock_t tms_stime;
4348352Scael	clock_t tms_cutime;
4448352Scael	clock_t tms_cstime;
4545145Sbostic}
4648352Scael.Ed
4748352Scael.Pp
4845145SbosticThe elements of this structure are defined as follows:
4948352Scael.Bl -tag -width tms_cutime
5048352Scael.It Fa tms_utime
5148352ScaelThe
5248352Scael.Tn CPU
5348352Scaeltime charged for the execution of user instructions.
5448352Scael.It Fa tms_stime
5548352ScaelThe
5648352Scael.Tn CPU
5748352Scaeltime charged for execution by the system on behalf of
5845145Sbosticthe process.
5948352Scael.It Fa tms_cutime
6045145SbosticThe sum of the
6148352Scael.Fa tms_utime  s
6245145Sbosticand
6348352Scael.Fa tms_cutime  s
6445145Sbosticof the child processes.
6548352Scael.It Fa tms_cstime
6645145SbosticThe sum of the
6748352Scael.Fa tms_stime Ns s
6845145Sbosticand
6948352Scael.Fa tms_cstime Ns s
7045145Sbosticof the child processes.
7148352Scael.El
7248352Scael.Pp
7348352ScaelAll times are in
7448352Scael.Dv CLK_TCK Ns 's
7548352Scaelof a second.
7648352Scael.Pp
7745145SbosticThe times of a terminated child process are included in the
7848352Scael.Fa tms_cutime
7945145Sbosticand
8048352Scael.Fa tms_cstime
8145145Sbosticelements of the parent when one of the
8248352Scael.Xr wait 2
8348352Scaelfunctions returns the process ID of the terminated child to the parent.
8445145SbosticIf an error occurs,
8548352Scael.Fn times
8648352Scaelreturns the value
8748352Scael.Pq (clock_t)\-1 ,
8848352Scaeland sets errno to indicate the error.
8948352Scael.Sh ERRORS
9048352ScaelThe
9148352Scael.Fn times
9248352Scaelfunction
9348352Scaelmay fail and set the global variable
9448352Scael.Va errno
9548352Scaelfor any of the errors specified for the library
9645145Sbosticroutines
9748352Scael.Xr getrusage 2
9845145Sbosticand
9948352Scael.Xr gettimeofday 2 .
10048352Scael.Sh SEE ALSO
10148352Scael.Xr time 1 ,
10248352Scael.Xr getrusage 2 ,
10348352Scael.Xr gettimeofday 2 ,
10448352Scael.Xr wait 2
10548352Scael.Sh STANDARDS
10648352ScaelThe
10748352Scael.Fn times
10848352Scaelfunction
10948352Scaelconforms to
11048352Scael.St -p1003.1-88 .
111