| @@ 435-458 (lines=24) @@ | ||
| 432 | * |
|
| 433 | * @return void |
|
| 434 | */ |
|
| 435 | protected function _processes() |
|
| 436 | { |
|
| 437 | if (CommonFunctions::executeProgram('ps', 'aux', $bufr, PSI_DEBUG)) { |
|
| 438 | $lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
|
| 439 | $processes['*'] = 0; |
|
| 440 | foreach ($lines as $line) { |
|
| 441 | if (preg_match("/^\S+\s+\d+\s+\S+\s+\S+\s+\d+\s+\d+\s+\S+\s+(\w)/", $line, $ar_buf)) { |
|
| 442 | $processes['*']++; |
|
| 443 | $state = $ar_buf[1]; |
|
| 444 | if ($state == 'U') $state = 'D'; //linux format |
|
| 445 | elseif ($state == 'I') $state = 'S'; |
|
| 446 | elseif ($state == 'D') $state = 'd'; //invalid |
|
| 447 | if (isset($processes[$state])) { |
|
| 448 | $processes[$state]++; |
|
| 449 | } else { |
|
| 450 | $processes[$state] = 1; |
|
| 451 | } |
|
| 452 | } |
|
| 453 | } |
|
| 454 | if ($processes['*'] > 0) { |
|
| 455 | $this->sys->setProcesses($processes); |
|
| 456 | } |
|
| 457 | } |
|
| 458 | } |
|
| 459 | ||
| 460 | /** |
|
| 461 | * get the information |
|
| @@ 287-310 (lines=24) @@ | ||
| 284 | * |
|
| 285 | * @return void |
|
| 286 | */ |
|
| 287 | protected function _processes() |
|
| 288 | { |
|
| 289 | if (CommonFunctions::executeProgram('ps', 'aux', $bufr, PSI_DEBUG)) { |
|
| 290 | $lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
|
| 291 | $processes['*'] = 0; |
|
| 292 | foreach ($lines as $line) { |
|
| 293 | if (preg_match("/^\S+\s+\d+\s+\S+\s+\S+\s+\d+\s+\d+\s+\S+\s+(\w)/", $line, $ar_buf)) { |
|
| 294 | $processes['*']++; |
|
| 295 | $state = $ar_buf[1]; |
|
| 296 | if ($state == 'O') $state = 'R'; //linux format |
|
| 297 | elseif ($state == 'W') $state = 'D'; |
|
| 298 | elseif ($state == 'D') $state = 'd'; //invalid |
|
| 299 | if (isset($processes[$state])) { |
|
| 300 | $processes[$state]++; |
|
| 301 | } else { |
|
| 302 | $processes[$state] = 1; |
|
| 303 | } |
|
| 304 | } |
|
| 305 | } |
|
| 306 | if ($processes['*'] > 0) { |
|
| 307 | $this->sys->setProcesses($processes); |
|
| 308 | } |
|
| 309 | } |
|
| 310 | } |
|
| 311 | ||
| 312 | /** |
|
| 313 | * get the information |
|