reference/info/functions/getrusage.xml
e947f2e12b1e321d67f6560c5f2884e6d885858f
...
...
@@ -9,8 +9,8 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>array</type><methodname>getrusage</methodname>
13
-
<methodparam choice="opt"><type>int</type><parameter>who</parameter><initializer>0</initializer></methodparam>
12
+
<type class="union"><type>array</type><type>false</type></type><methodname>getrusage</methodname>
13
+
<methodparam choice="opt"><type>int</type><parameter>mode</parameter><initializer>0</initializer></methodparam>
14
14
</methodsynopsis>
15
15
<para>
16
16
This is an interface to <command>getrusage(2)</command>. It gets data returned
...
...
@@ -23,10 +23,10 @@
23
23
<para>
24
24
<variablelist>
25
25
<varlistentry>
26
-
<term><parameter>who</parameter></term>
26
+
<term><parameter>mode</parameter></term>
27
27
<listitem>
28
28
<para>
29
-
If <parameter>who</parameter> is 1, getrusage will be called with
29
+
If <parameter>mode</parameter> is 1, getrusage will be called with
30
30
<constant>RUSAGE_CHILDREN</constant>.
31
31
</para>
32
32
</listitem>
...
...
@@ -40,26 +40,7 @@
40
40
<para>
41
41
Returns an associative array containing the data returned from the system
42
42
call. All entries are accessible by using their documented field names.
43
-
</para>
44
-
</refsect1>
45
-

46
-
<refsect1 role="examples">
47
-
&reftitle.examples;
48
-
<para>
49
-
<example>
50
-
<title><function>getrusage</function> example</title>
51
-
<programlisting role="php">
52
-
<![CDATA[
53
-
<?php
54
-
$dat = getrusage();
55
-
echo $dat["ru_nswap"]; // number of swaps
56
-
echo $dat["ru_majflt"]; // number of page faults
57
-
echo $dat["ru_utime.tv_sec"]; // user time used (seconds)
58
-
echo $dat["ru_utime.tv_usec"]; // user time used (microseconds)
59
-
?>
60
-
]]>
61
-
</programlisting>
62
-
</example>
43
+
Returns &false; on failure.
63
44
</para>
64
45
</refsect1>
65
46

...
...
@@ -87,6 +68,39 @@ echo $dat["ru_utime.tv_usec"]; // user time used (microseconds)
87
68
</para>
88
69
</refsect1>
89
70

71
+
<refsect1 role="examples">
72
+
&reftitle.examples;
73
+
<para>
74
+
<example>
75
+
<title><function>getrusage</function> example</title>
76
+
<programlisting role="php">
77
+
<![CDATA[
78
+
<?php
79
+
$dat = getrusage();
80
+
echo $dat["ru_oublock"]; // number of block output operations
81
+
echo $dat["ru_inblock"]; // number of block input operations
82
+
echo $dat["ru_msgsnd"]; // number of IPC messages sent
83
+
echo $dat["ru_msgrcv"]; // number of IPC messages received
84
+
echo $dat["ru_maxrss"]; // maximum resident set size
85
+
echo $dat["ru_ixrss"]; // integral shared memory size
86
+
echo $dat["ru_idrss"]; // integral unshared data size
87
+
echo $dat["ru_minflt"]; // number of page reclaims (soft page faults)
88
+
echo $dat["ru_majflt"]; // number of page faults (hard page faults)
89
+
echo $dat["ru_nsignals"]; // number of signals received
90
+
echo $dat["ru_nvcsw"]; // number of voluntary context switches
91
+
echo $dat["ru_nivcsw"]; // number of involuntary context switches
92
+
echo $dat["ru_nswap"]; // number of swaps
93
+
echo $dat["ru_utime.tv_usec"]; // user time used (microseconds)
94
+
echo $dat["ru_utime.tv_sec"]; // user time used (seconds)
95
+
echo $dat["ru_stime.tv_usec"]; // system time used (microseconds)
96
+
echo $dat["ru_stime.tv_sec"]; // system time used (seconds)
97
+
?>
98
+
]]>
99
+
</programlisting>
100
+
</example>
101
+
</para>
102
+
</refsect1>
103
+

90
104
<refsect1 role="notes">
91
105
&reftitle.notes;
92
106
<note>
...
...
@@ -101,17 +115,17 @@ echo $dat["ru_utime.tv_usec"]; // user time used (microseconds)
101
115
<member><literal>"ru_utime.tv_sec"</literal></member>
102
116
<member><literal>"ru_utime.tv_usec"</literal></member>
103
117
<member>
104
-
<literal>"ru_majflt"</literal> (only if <parameter>who</parameter> is
118
+
<literal>"ru_majflt"</literal> (only if <parameter>mode</parameter> is
105
119
<constant>RUSAGE_SELF</constant>)
106
120
</member>
107
121
<member>
108
-
<literal>"ru_maxrss"</literal> (only if <parameter>who</parameter> is
122
+
<literal>"ru_maxrss"</literal> (only if <parameter>mode</parameter> is
109
123
<constant>RUSAGE_SELF</constant>)
110
124
</member>
111
125
</simplelist>
112
126
</para>
113
127
<para>
114
-
If <function>getrusage</function> is called with <parameter>who</parameter>
128
+
If <function>getrusage</function> is called with <parameter>mode</parameter>
115
129
set to <literal>1</literal> (<constant>RUSAGE_CHILDREN</constant>), then
116
130
resource usage for threads are collected (meaning that internally the function
117
131
is called with <constant>RUSAGE_THREAD</constant>).
...
...
@@ -142,7 +156,6 @@ echo $dat["ru_utime.tv_usec"]; // user time used (microseconds)
142
156
</refsect1>
143
157

144
158
</refentry>
145
-

146
159
<!-- Keep this comment at the end of the file
147
160
Local variables:
148
161
mode: sgml
149
162