protected function prepareContinuePids(ContinueDto $continueDto) { $pauseStanderArr = $this->getTerminatorPauseStanderArr(); $pauseStanderArr[TerminatorPauseStanderConstants::PIDS_FOR_CONTINUE] = $continueDto->getPidsForContinue(); return $pauseStanderArr; }
protected function calculateProcessesNumberToContinue() { $continueDto = new ContinueDto(); $possiblePidUsage = 0; $pidsForContinue = []; /** * @var PidCpuMemDto $pidInfo */ foreach ($this->pidsForPause as $pidInfo) { if ($possiblePidUsage + $pidInfo->getPidCpuUsage() < $this->allowingCpuUsage) { $possiblePidUsage += $pidInfo->getPidCpuUsage(); $pidsForContinue[] = $pidInfo->getPid(); unset($this->pidsForPause[$pidInfo->getPid()]); } else { break; } } $continueDto->setPidsForContinue($pidsForContinue); return $continueDto; }