protected function managingTimer() { $this->loop->addPeriodicTimer(0.01, function (Timer $timer) { if ($this->receivePmInfo) { //to protect against periodic income before send and thus against calculation duplicate $this->receivePmInfo = false; $this->systemInfo = $this->commandsManager->getSystemLoadInfo(); $this->checkCpuIdle(); $this->pidsInfo = []; $this->logger->info("Pids contain before tryGetPidInfo (number): " . count($this->pids)); if (!empty($this->pids)) { foreach ($this->pids as $key => $pid) { $this->tryGetPidInfo($key, $pid); } } foreach ($this->selfPids as $key => $pid) { $this->tryGetPidInfo($key, $pid, true); } $this->logger->info("Pids contain after tryGetPidInfo (number): " . count($this->pids)); $this->logger->info("PidsInfo contain (number): " . count($this->pidsInfo)); //$this->logger->info("Self pids at start: " . serialize($this->selfPidsAtStart)); if (empty($this->pids) === false) { $this->logger->info("Come to resolve pids info."); $this->resolveLoadInfo(); } elseif ($this->allProcessesCreated === true) { if (!$this->finishingInitialized) { $this->logger->critical("Come to finish dto."); $this->logger->critical("Pids: " . serialize($this->pids)); $this->logger->critical("PidsInfo: " . serialize($this->pidsInfo)); $this->logger->critical("FinishedPids: " . serialize($this->finishedPids)); $this->logger->critical("SelfPids: " . serialize($this->selfPids)); $this->initFinishDto(); } } else { $this->logger->warning("LM pids empty. Check if exceeded minMemLimit"); if ($this->systemInfo->getMemFree() < $this->minMemFreeSize) { $reason = "LM pids empty and MemFree is on critical level: " . $this->systemInfo->getMemFree() . " Init critical finishing."; $this->logger->warning($reason); $this->initCriticalFinishDto($reason); } else { $this->dtoContainer->setDto(new LmStateDto()); } } } }); return null; }