1times(2)                         System Calls                         times(2)
2
3
4

NAME

6       times - get process and child process times
7

SYNOPSIS

9       #include <sys/times.h>
10       #include <limits.h>
11
12       clock_t times(struct tms *buffer);
13
14

DESCRIPTION

16       The  times() function fills the tms structure pointed to by buffer with
17       time-accounting   information.   The   tms   structure,   defined    in
18       <sys/times.h>, contains the following members:
19
20         clock_t    tms_utime;
21         clock_t    tms_stime;
22         clock_t    tms_cutime;
23         clock_t    tms_cstime;
24
25
26
27       All  times  are reported in clock ticks. The specific value for a clock
28       tick is defined by the variable CLK_TCK,  found  in  the  header  <lim‐
29       its.h>.
30
31
32       The  times of a terminated child process are included in the tms_cutime
33       and tms_cstime members of  the  parent  when  wait(3C)  or  waitpid(3C)
34       returns  the  process  ID of this terminated child.  If a child process
35       has not waited for its children, their times will not  be  included  in
36       its times.
37
38
39       The  tms_utime member is the CPU time used while executing instructions
40       in the user space of the calling process.
41
42
43       The tms_stime member is the CPU time used by the system  on  behalf  of
44       the calling process.
45
46
47       The tms_cutime member is the sum of the tms_utime and the tms_cutime of
48       the child processes.
49
50
51       The tms_cstime member is the sum of the tms_stime and the tms_cstime of
52       the child processes.
53

RETURN VALUES

55       Upon  successful  completion, times() returns the elapsed real time, in
56       clock ticks, since an arbitrary point in the past (for example,  system
57       start-up  time).  This  point  does  not  change from one invocation of
58       times() within the process to another. The return  value  may  overflow
59       the  possible  range  of type clock_t. If times() fails, (clock_t)−1 is
60       returned and errno is set to indicate the error.
61

ERRORS

63       The times() function will fail if:
64
65       EFAULT    The buffer argument points to an illegal address.
66
67

ATTRIBUTES

69       See attributes(5) for descriptions of the following attributes:
70
71
72
73
74       ┌─────────────────────────────┬─────────────────────────────┐
75       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
76       ├─────────────────────────────┼─────────────────────────────┤
77       │Interface Stability          │Standard                     │
78       ├─────────────────────────────┼─────────────────────────────┤
79       │MT-Level                     │Async-Signal-Safe            │
80       └─────────────────────────────┴─────────────────────────────┘
81

SEE ALSO

83       time(1), timex(1),  exec(2),  fork(2),  time(2),  waitid(2),  wait(3C),
84       waitpid(3C), attributes(5), standards(5)
85
86
87
88SunOS 5.11                        14 May 1997                         times(2)
Impressum