xref: /386bsd/usr/share/man/cat2/getrusage.0 (revision a2142627)
1GETRUSAGE(2)              386BSD Programmer's Manual              GETRUSAGE(2)
2
3NNAAMMEE
4     ggeettrruussaaggee - get information about resource utilization
5
6SSYYNNOOPPSSIISS
7     ##iinncclluuddee <<ssyyss//ttiimmee..hh>>
8     ##iinncclluuddee <<ssyyss//rreessoouurrccee..hh>>
9     ##ddeeffiinnee   RRUUSSAAGGEE__SSEELLFF     00
10     ##ddeeffiinnee   RRUUSSAAGGEE__CCHHIILLDDRREENN     --11
11
12     _i_n_t
13     ggeettrruussaaggee(_i_n_t _w_h_o, _s_t_r_u_c_t _r_u_s_a_g_e *_r_u_s_a_g_e)
14
15DDEESSCCRRIIPPTTIIOONN
16     GGeettrruussaaggee() returns information describing the resources utilized by the
17     current process, or all its terminated child processes.  The _w_h_o
18     parameter is either RUSAGE_SELF or RUSAGE_CHILDREN. The buffer to which
19     _r_u_s_a_g_e points will be filled in with the following structure:
20
21     struct rusage {
22             struct timeval ru_utime; /* user time used */
23             struct timeval ru_stime; /* system time used */
24             long ru_maxrss;          /* integral max resident set size */
25             long ru_ixrss;           /* integral shared text memory size */
26             long ru_idrss;           /* integral unshared data size */
27             long ru_isrss;           /* integral unshared stack size */
28             long ru_minflt;          /* page reclaims */
29             long ru_majflt;          /* page faults */
30             long ru_nswap;           /* swaps */
31             long ru_inblock;         /* block input operations */
32             long ru_oublock;         /* block output operations */
33             long ru_msgsnd;          /* messages sent */
34             long ru_msgrcv;          /* messages received */
35             long ru_nsignals;        /* signals received */
36             long ru_nvcsw;           /* voluntary context switches */
37             long ru_nivcsw;          /* involuntary context switches */
38     };
39
40     The fields are interpreted as follows:
41
42     _r_u__u_t_i_m_e     the total amount of time spent executing in user mode.
43
44     _r_u__s_t_i_m_e     the total amount of time spent in the system executing on
45                  behalf of the process(es).
46
47     _r_u__m_a_x_r_s_s    the maximum resident set size utilized (in kilobytes).
48
49     _r_u__i_x_r_s_s     an integral value indicating the amount of memory used by
50                  the text segment that was also shared among other processes.
51                  This value is expressed in units of kilobytes * ticks-of-
52                  execution.
53
54     _r_u__i_d_r_s_s     an integral value of the amount of unshared memory residing
55                  in the data segment of a process (expressed in units of
56                  kilobytes * ticks-of-execution).
57
58     _r_u__i_s_r_s_s     an integral value of the amount of unshared memory residing
59                  in the stack segment of a process (expressed in units of
60                  kilobytes * ticks-of-execution).
61
62     _r_u__m_i_n_f_l_t    the number of page faults serviced without any I/O activity;
63                  here I/O activity is avoided by reclaiming a page frame from
64
65
66                  the list of pages awaiting reallocation.
67
68     _r_u__m_a_j_f_l_t    the number of page faults serviced that required I/O
69                  activity.
70
71     _r_u__n_s_w_a_p     the number of times a process was swapped out of main
72                  memory.
73
74     _r_u__i_n_b_l_o_c_k   the number of times the file system had to perform input.
75
76     _r_u__o_u_b_l_o_c_k   the number of times the file system had to perform output.
77
78     _r_u__m_s_g_s_n_d    the number of IPC messages sent.
79
80     _r_u__m_s_g_r_c_v    the number of IPC messages received.
81
82     _r_u__n_s_i_g_n_a_l_s  the number of signals delivered.
83
84     _r_u__n_v_c_s_w     the number of times a context switch resulted due to a
85                  process voluntarily giving up the processor before its time
86                  slice was completed (usually to await availability of a
87                  resource).
88
89     _r_u__n_i_v_c_s_w    the number of times a context switch resulted due to a
90                  higher priority process becoming runnable or because the
91                  current process exceeded its time slice.
92
93NNOOTTEESS
94     The numbers _r_u__i_n_b_l_o_c_k and _r_u__o_u_b_l_o_c_k account only for real I/O; data
95     supplied by the caching mechanism is charged only to the first process to
96     read or write the data.
97
98EERRRROORRSS
99     GGeettrruussaaggee() returns -1 on error.  The possible errors are:
100
101     [EINVAL]      The _w_h_o parameter is not a valid value.
102
103     [EFAULT]      The address specified by the _r_u_s_a_g_e parameter is not in a
104                   valid part of the process address space.
105
106SSEEEE AALLSSOO
107     gettimeofday(2),  wait(2)
108
109BBUUGGSS
110     There is no way to obtain information about a child process that has not
111     yet terminated.
112
113HHIISSTTOORRYY
114     The ggeettrruussaaggee function call appeared in 4.2BSD.
115
1164th Berkeley Distribution       March 10, 1991                               2
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133