@@ 115-136 (lines=22) @@ | ||
112 | * |
|
113 | * @return void |
|
114 | */ |
|
115 | protected function _processes() |
|
116 | { |
|
117 | if (CommonFunctions::executeProgram('ps', 'aux', $bufr, PSI_DEBUG)) { |
|
118 | $lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
|
119 | $processes['*'] = 0; |
|
120 | foreach ($lines as $line) { |
|
121 | if (preg_match("/^\S+\s+\d+\s+\S+\s+\S+\s+\d+\s+\d+\s+\S+\s+(\w)/", $line, $ar_buf)) { |
|
122 | $processes['*']++; |
|
123 | $state = $ar_buf[1]; |
|
124 | if ($state == 'I') $state = 'S'; //linux format |
|
125 | if (isset($processes[$state])) { |
|
126 | $processes[$state]++; |
|
127 | } else { |
|
128 | $processes[$state] = 1; |
|
129 | } |
|
130 | } |
|
131 | } |
|
132 | if ($processes['*'] > 0) { |
|
133 | $this->sys->setProcesses($processes); |
|
134 | } |
|
135 | } |
|
136 | } |
|
137 | ||
138 | /** |
|
139 | * get the information |
@@ 184-205 (lines=22) @@ | ||
181 | * |
|
182 | * @return void |
|
183 | */ |
|
184 | protected function _processes() |
|
185 | { |
|
186 | if (CommonFunctions::executeProgram('ps', 'aux', $bufr, PSI_DEBUG)) { |
|
187 | $lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
|
188 | $processes['*'] = 0; |
|
189 | foreach ($lines as $line) { |
|
190 | if (preg_match("/^\S+\s+\d+\s+\S+\s+\S+\s+\d+\s+\d+\s+\S+\s+(\w)/", $line, $ar_buf)) { |
|
191 | $processes['*']++; |
|
192 | $state = $ar_buf[1]; |
|
193 | if ($state == 'I') $state = 'S'; //linux format |
|
194 | if (isset($processes[$state])) { |
|
195 | $processes[$state]++; |
|
196 | } else { |
|
197 | $processes[$state] = 1; |
|
198 | } |
|
199 | } |
|
200 | } |
|
201 | if ($processes['*'] > 0) { |
|
202 | $this->sys->setProcesses($processes); |
|
203 | } |
|
204 | } |
|
205 | } |
|
206 | ||
207 | /** |
|
208 | * get the information |