1/* Define struct rusage.
2 Copyright (C) 1994-2022 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef __rusage_defined
20#define __rusage_defined 1
21
22#include <bits/types.h>
23#include <bits/types/struct_timeval.h>
24
25/* Structure which says how much of each resource has been used. If
26 the system does not keep track of a particular value, the struct
27 field is always zero. */
28
29/* The purpose of all the unions is to have the kernel-compatible layout
30 while keeping the API type as 'long int', and among machines where
31 __syscall_slong_t is not 'long int', this only does the right thing
32 for little-endian ones, like x32. */
33struct rusage
34 {
35 /* Total amount of user time used. */
36 struct timeval ru_utime;
37 /* Total amount of system time used. */
38 struct timeval ru_stime;
39 /* Maximum resident set size (in kilobytes). */
40 __extension__ union
41 {
42 long int ru_maxrss;
43 __syscall_slong_t __ru_maxrss_word;
44 };
45 /* Amount of sharing of text segment memory
46 with other processes (kilobyte-seconds). */
47 __extension__ union
48 {
49 long int ru_ixrss;
50 __syscall_slong_t __ru_ixrss_word;
51 };
52 /* Amount of data segment memory used (kilobyte-seconds). */
53 __extension__ union
54 {
55 long int ru_idrss;
56 __syscall_slong_t __ru_idrss_word;
57 };
58 /* Amount of stack memory used (kilobyte-seconds). */
59 __extension__ union
60 {
61 long int ru_isrss;
62 __syscall_slong_t __ru_isrss_word;
63 };
64 /* Number of soft page faults (i.e. those serviced by reclaiming
65 a page from the list of pages awaiting reallocation. */
66 __extension__ union
67 {
68 long int ru_minflt;
69 __syscall_slong_t __ru_minflt_word;
70 };
71 /* Number of hard page faults (i.e. those that required I/O). */
72 __extension__ union
73 {
74 long int ru_majflt;
75 __syscall_slong_t __ru_majflt_word;
76 };
77 /* Number of times a process was swapped out of physical memory. */
78 __extension__ union
79 {
80 long int ru_nswap;
81 __syscall_slong_t __ru_nswap_word;
82 };
83 /* Number of input operations via the file system. Note: This
84 and `ru_oublock' do not include operations with the cache. */
85 __extension__ union
86 {
87 long int ru_inblock;
88 __syscall_slong_t __ru_inblock_word;
89 };
90 /* Number of output operations via the file system. */
91 __extension__ union
92 {
93 long int ru_oublock;
94 __syscall_slong_t __ru_oublock_word;
95 };
96 /* Number of IPC messages sent. */
97 __extension__ union
98 {
99 long int ru_msgsnd;
100 __syscall_slong_t __ru_msgsnd_word;
101 };
102 /* Number of IPC messages received. */
103 __extension__ union
104 {
105 long int ru_msgrcv;
106 __syscall_slong_t __ru_msgrcv_word;
107 };
108 /* Number of signals delivered. */
109 __extension__ union
110 {
111 long int ru_nsignals;
112 __syscall_slong_t __ru_nsignals_word;
113 };
114 /* Number of voluntary context switches, i.e. because the process
115 gave up the process before it had to (usually to wait for some
116 resource to be available). */
117 __extension__ union
118 {
119 long int ru_nvcsw;
120 __syscall_slong_t __ru_nvcsw_word;
121 };
122 /* Number of involuntary context switches, i.e. a higher priority process
123 became runnable or the current process used up its time slice. */
124 __extension__ union
125 {
126 long int ru_nivcsw;
127 __syscall_slong_t __ru_nivcsw_word;
128 };
129 };
130
131#endif
132