xref: /PHP-8.4/win32/getrusage.h (revision 01b3fc03)
1 /*
2    +----------------------------------------------------------------------+
3    | Copyright (c) The PHP Group                                          |
4    +----------------------------------------------------------------------+
5    | This source file is subject to version 3.01 of the PHP license,      |
6    | that is bundled with this package in the file LICENSE, and is        |
7    | available through the world-wide-web at the following url:           |
8    | https://www.php.net/license/3_01.txt                                 |
9    | If you did not receive a copy of the PHP license and are unable to   |
10    | obtain it through the world-wide-web, please send a note to          |
11    | license@php.net so we can mail you a copy immediately.               |
12    +----------------------------------------------------------------------+
13    | Authors: Kalle Sommer Nielsen <kalle@php.net>                        |
14    +----------------------------------------------------------------------+
15  */
16 
17 #ifndef HAVE_GETRUSAGE_H
18 # define HAVE_GETRUSAGE_H
19 
20 /*
21  * Note
22  *
23  * RUSAGE_CHILDREN is not implemented, and the RUSAGE_THREAD will
24  * therefore instead be used instead to emulate the behavior.
25  */
26 
27 # define RUSAGE_SELF		0
28 # define RUSAGE_CHILDREN	1
29 
30 # define RUSAGE_THREAD		RUSAGE_CHILDREN
31 
32 /*
33  * Implementation support
34  *
35  *  RUSAGE_SELF
36  *		ru_utime
37  *		ru_stime
38  *		ru_majflt
39  *		ru_maxrss
40  *
41  *  RUSAGE_THREAD
42  *		ru_utime
43  *		ru_stime
44  *
45  * Not implemented:
46  *		ru_ixrss		(unused)
47  *		ru_idrss		(unused)
48  *		ru_isrss		(unused)
49  *		ru_minflt
50  *		ru_nswap		(unused)
51  *		ru_inblock
52  *		ru_oublock
53  *		ru_msgsnd		(unused)
54  *		ru_msgrcv		(unused)
55  *		ru_nsignals		(unused)
56  *		ru_nvcsw
57  *		ru_nivcsw
58  */
59 
60 struct rusage
61 {
62 	/* User time used */
63 	struct timeval ru_utime;
64 
65 	/* System time used */
66 	struct timeval ru_stime;
67 
68 	/* Integral max resident set size */
69 	zend_long ru_maxrss;
70 
71 	/* Page faults */
72 	zend_long ru_majflt;
73 #if 0
74 	/* Integral shared text memory size */
75 	zend_long ru_ixrss;
76 
77 	/* Integral unshared data size */
78 	zend_long ru_idrss;
79 
80 	/* Integral unshared stack size */
81 	zend_long ru_isrss;
82 
83 	/* Page reclaims */
84 	zend_long ru_minflt;
85 
86 	/* Swaps */
87 	zend_long ru_nswap;
88 
89 	/* Block input operations */
90 	zend_long ru_inblock;
91 
92 	/* Block output operations */
93 	zend_long ru_oublock;
94 
95 	/* Messages sent */
96 	zend_long ru_msgsnd;
97 
98 	/* Messages received */
99 	zend_long ru_msgrcv;
100 
101 	/* Signals received */
102 	zend_long ru_nsignals;
103 
104 	/* Voluntary context switches */
105 	zend_long ru_nvcsw;
106 
107 	/* Involuntary context switches */
108 	zend_long ru_nivcsw;
109 #endif
110 };
111 
112 PHPAPI int getrusage(int who, struct rusage *usage);
113 
114 #endif
115