| @@ 161-183 (lines=23) @@ | ||
| 158 | * |
|
| 159 | * @return void |
|
| 160 | */ |
|
| 161 | protected function _processes() |
|
| 162 | { |
|
| 163 | if (CommonFunctions::executeProgram('ps', 'aux', $bufr, PSI_DEBUG)) { |
|
| 164 | $lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
|
| 165 | $processes['*'] = 0; |
|
| 166 | foreach ($lines as $line) { |
|
| 167 | if (preg_match("/^\S+\s+\d+\s+\S+\s+\S+\s+\d+\s+\d+\s+\S+\s+(\w)/", $line, $ar_buf)) { |
|
| 168 | $processes['*']++; |
|
| 169 | $state = $ar_buf[1]; |
|
| 170 | if ($state == 'L') $state = 'D'; //linux format |
|
| 171 | elseif ($state == 'I') $state = 'S'; |
|
| 172 | if (isset($processes[$state])) { |
|
| 173 | $processes[$state]++; |
|
| 174 | } else { |
|
| 175 | $processes[$state] = 1; |
|
| 176 | } |
|
| 177 | } |
|
| 178 | } |
|
| 179 | if ($processes['*'] > 0) { |
|
| 180 | $this->sys->setProcesses($processes); |
|
| 181 | } |
|
| 182 | } |
|
| 183 | } |
|
| 184 | ||
| 185 | /** |
|
| 186 | * get the information |
|
| @@ 305-327 (lines=23) @@ | ||
| 302 | * |
|
| 303 | * @return void |
|
| 304 | */ |
|
| 305 | protected function _processes() |
|
| 306 | { |
|
| 307 | if (CommonFunctions::executeProgram('ps', 'alx', $bufr, PSI_DEBUG)) { |
|
| 308 | $lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
|
| 309 | $processes['*'] = 0; |
|
| 310 | foreach ($lines as $line) { |
|
| 311 | if (preg_match("/^\s(\w)\s/", $line, $ar_buf)) { |
|
| 312 | $processes['*']++; |
|
| 313 | $state = $ar_buf[1]; |
|
| 314 | if ($state == 'W') $state = 'D'; //linux format |
|
| 315 | elseif ($state == 'D') $state = 'd'; //invalid |
|
| 316 | if (isset($processes[$state])) { |
|
| 317 | $processes[$state]++; |
|
| 318 | } else { |
|
| 319 | $processes[$state] = 1; |
|
| 320 | } |
|
| 321 | } |
|
| 322 | } |
|
| 323 | if ($processes['*'] > 0) { |
|
| 324 | $this->sys->setProcesses($processes); |
|
| 325 | } |
|
| 326 | } |
|
| 327 | } |
|
| 328 | ||
| 329 | /** |
|
| 330 | * get the information |
|
| @@ 146-168 (lines=23) @@ | ||
| 143 | * |
|
| 144 | * @return void |
|
| 145 | */ |
|
| 146 | protected function _processes() |
|
| 147 | { |
|
| 148 | if (CommonFunctions::executeProgram('ps', 'aux', $bufr, PSI_DEBUG)) { |
|
| 149 | $lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
|
| 150 | $processes['*'] = 0; |
|
| 151 | foreach ($lines as $line) { |
|
| 152 | if (preg_match("/^\S+\s+\d+\s+\S+\s+\S+\s+\d+\s+\d+\s+\S+\s+(\w)/", $line, $ar_buf)) { |
|
| 153 | $processes['*']++; |
|
| 154 | $state = $ar_buf[1]; |
|
| 155 | if ($state == 'O') $state = 'R'; //linux format |
|
| 156 | elseif ($state == 'I') $state = 'S'; |
|
| 157 | if (isset($processes[$state])) { |
|
| 158 | $processes[$state]++; |
|
| 159 | } else { |
|
| 160 | $processes[$state] = 1; |
|
| 161 | } |
|
| 162 | } |
|
| 163 | } |
|
| 164 | if ($processes['*'] > 0) { |
|
| 165 | $this->sys->setProcesses($processes); |
|
| 166 | } |
|
| 167 | } |
|
| 168 | } |
|
| 169 | ||
| 170 | /** |
|
| 171 | * get the information |
|