generate the memory information

@return void
551660
private function _buildMemory()
    {
        $memory = $this->_xml->addChild('Memory');
        $memory->addAttribute('Free', $this->_sys->getMemFree());
        $memory->addAttribute('Used', $this->_sys->getMemUsed());
        $memory->addAttribute('Total', $this->_sys->getMemTotal());
        $memory->addAttribute('Percent', $this->_sys->getMemPercentUsed());
        if (($this->_sys->getMemApplication() !== null) || ($this->_sys->getMemBuffer() !== null) || ($this->_sys->getMemCache() !== null)) {
            $details = $memory->addChild('Details');
            if ($this->_sys->getMemApplication() !== null) {
                $details->addAttribute('App', $this->_sys->getMemApplication());
                $details->addAttribute('AppPercent', $this->_sys->getMemPercentApplication());
            }
            if ($this->_sys->getMemBuffer() !== null) {
                $details->addAttribute('Buffers', $this->_sys->getMemBuffer());
                $details->addAttribute('BuffersPercent', $this->_sys->getMemPercentBuffer());
            }
            if ($this->_sys->getMemCache() !== null) {
                $details->addAttribute('Cached', $this->_sys->getMemCache());
                $details->addAttribute('CachedPercent', $this->_sys->getMemPercentCache());
            }
        }
        if (count($this->_sys->getSwapDevices()) > 0) {
            $swap = $memory->addChild('Swap');
            $swap->addAttribute('Free', $this->_sys->getSwapFree());
            $swap->addAttribute('Used', $this->_sys->getSwapUsed());
            $swap->addAttribute('Total', $this->_sys->getSwapTotal());
            $swap->addAttribute('Percent', $this->_sys->getSwapPercentUsed());
            $i = 1;
            foreach ($this->_sys->getSwapDevices() as $dev) {
                $swapMount = $swap->addChild('Mount');
                $this->_fillDevice($swapMount, $dev, $i++);
            }
        }
    }
351481
public function memory_total()
    {
        $mem_total = 0;
        if ($this->host_os === 'WINDOWS') {
            $wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
            $os =  $wmi->ExecQuery("SELECT * FROM Win32_OperatingSystem");

            foreach ($os as $m) {
                $mem_total = $m->TotalVisibleMemorySize;
            }
        } else {
            $fh = fopen('/proc/meminfo', 'r');

            while ($line = fgets($fh)) {
                $pieces = array();
                if (preg_match('/^MemTotal:\s+(\d+)\skB$/', trim($line), $pieces)) {
                    $mem_total = $pieces[1];
                    break;
                }
            }
            fclose($fh);
        }
        return $mem_total;
    }
962227
protected function system_memory_info()
    {

        $this->system_memory_kb = array();

        exec("cat /proc/meminfo", $output);
        foreach ($output as $line) {
            $parts = explode(':', $line);

            if (empty($parts[0])) continue;
            // remove the KB sign and reduce it to a key value array
            $this->system_memory_kb[trim($parts[0])] = (int)(!empty($parts[1]) ? trim(str_replace('kB', '', $parts[1])) : null);
        }

        return true;
    }
292355
private function _memoryadditional()
    {
        $pagesize = $this->grabkey("hw.pagesize");
        $this->sys->setMemCache($this->grabkey("vm.stats.vm.v_cache_count") * $pagesize);
        $this->sys->setMemApplication(($this->grabkey("vm.stats.vm.v_active_count") + $this->grabkey("vm.stats.vm.v_wire_count")) * $pagesize);
        $this->sys->setMemBuffer($this->sys->getMemUsed() - $this->sys->getMemApplication() - $this->sys->getMemCache());
    }
227661
protected function _memory()
    {
        if (CommonFunctions::rfts('/proc/meminfo', $mbuf)) {
            $bufe = preg_split("/\n/", $mbuf, -1, PREG_SPLIT_NO_EMPTY);
            foreach ($bufe as $buf) {
                if (preg_match('/^MemTotal:\s+(\d+)\s*kB/i', $buf, $ar_buf)) {
                    $this->sys->setMemTotal($ar_buf[1] * 1024);
                } elseif (preg_match('/^MemFree:\s+(\d+)\s*kB/i', $buf, $ar_buf)) {
                    $this->sys->setMemFree($ar_buf[1] * 1024);
                } elseif (preg_match('/^Cached:\s+(\d+)\s*kB/i', $buf, $ar_buf)) {
                    $this->sys->setMemCache($ar_buf[1] * 1024);
                } elseif (preg_match('/^Buffers:\s+(\d+)\s*kB/i', $buf, $ar_buf)) {
                    $this->sys->setMemBuffer($ar_buf[1] * 1024);
                }
            }
            $this->sys->setMemUsed($this->sys->getMemTotal() - $this->sys->getMemFree());
            // values for splitting memory usage
            if ($this->sys->getMemCache() !== null && $this->sys->getMemBuffer() !== null) {
                $this->sys->setMemApplication($this->sys->getMemUsed() - $this->sys->getMemCache() - $this->sys->getMemBuffer());
            }
            if (CommonFunctions::rfts('/proc/swaps', $sbuf, 0, 4096, false)) {
                $swaps = preg_split("/\n/", $sbuf, -1, PREG_SPLIT_NO_EMPTY);
                unset($swaps[0]);
                foreach ($swaps as $swap) {
                    $ar_buf = preg_split('/\s+/', $swap, 5);
                    $dev = new DiskDevice();
                    $dev->setMountPoint($ar_buf[0]);
                    $dev->setName("SWAP");
                    $dev->setTotal($ar_buf[2] * 1024);
                    $dev->setUsed($ar_buf[3] * 1024);
                    $dev->setFree($dev->getTotal() - $dev->getUsed());
                    $this->sys->setSwapDevices($dev);
                }
            }
        }
    }
949737
protected function initializeFromStorage()
  {
    $this->debugLog('initializeFromStorage()');
    $this->lists=$this->storage->getLists();
    $this->next_request_timestamp=$this->storage->getNextRunTimestamp();
    $this->error_count=$this->storage->getErrorCount();
    
    $this->debugLog('current memory usage: '.memory_get_usage());
    $this->debugLog('peak memory usage   : '.memory_get_peak_usage());
  }
782615
private function _memory()
    {
        $mems = "";
        $tswap = "";
        $pswap = "";
        foreach ($this->readaixdata() as $line) {
            if (preg_match("/^Good Memory Size:\s+(\d+)\s+MB/", $line, $ar_buf)) {
                $mems = $ar_buf[1];
            }
            if (preg_match("/^\s*Total Paging Space:\s+(\d+)MB/", $line, $ar_buf)) {
                $tswap = $ar_buf[1];
            }
            if (preg_match("/^\s*Percent Used:\s+(\d+)%/", $line, $ar_buf)) {
                $pswap = $ar_buf[1];
            }
        }
        if (trim($mems) != "") {
            $mems = $mems*1024*1024;
            $this->sys->setMemTotal($mems);
            $memu = 0;
            $memf = 0;
            if (CommonFunctions::executeProgram('svmon', '-G', $buf)) {
                if (preg_match("/^memory\s+\d+\s+(\d+)\s+/", $buf, $ar_buf)) {
                    $memu = $ar_buf[1]*1024*4;
                    $memf = $mems - $memu;
                }
            }
            $this->sys->setMemUsed($memu);
            $this->sys->setMemFree($memf);
//            $this->sys->setMemApplication($mems);
//            $this->sys->setMemBuffer($mems);
//            $this->sys->setMemCache($mems);
        }
        if (trim($tswap) != "") {
            $dev = new DiskDevice();
            $dev->setName("SWAP");
            $dev->setFsType('swap');
            $dev->setTotal($tswap * 1024 * 1024);
            if (trim($pswap) != "") {
                $dev->setUsed($dev->getTotal() * $pswap / 100);
            }
            $dev->setFree($dev->getTotal() - $dev->getUsed());
            $this->sys->setSwapDevices($dev);
        }
    }
855895
private function generatePhpDocParameters(): void
  {
    $parameters = [];
    foreach ($this->routine['phpdoc']['parameters'] as $parameter)
    {
      $mangledName = $this->nameMangler->getParameterName($parameter['parameter_name']);

      $parameters[] = ['php_name'             => '$'.$mangledName,
                       'description'          => $parameter['description'],
                       'php_type'             => $parameter['php_type'],
                       'data_type_descriptor' => $parameter['data_type_descriptor']];
    }

    $this->enhancePhpDocParameters($parameters);

    if (!empty($parameters))
    {
      // Compute the max lengths of parameter names and the PHP types of the parameters.
      $max_name_length = 0;
      $max_type_length = 0;
      foreach ($parameters as $parameter)
      {
        $max_name_length = max($max_name_length, mb_strlen($parameter['php_name']));
        $max_type_length = max($max_type_length, mb_strlen($parameter['php_type']));
      }

      $this->codeStore->append(' *', false);

      // Generate phpDoc for the parameters of the wrapper method.
      foreach ($parameters as $parameter)
      {
        $format = sprintf(' * %%-%ds %%-%ds %%-%ds %%s', mb_strlen('@param'), $max_type_length, $max_name_length);

        $lines = explode(PHP_EOL, $parameter['description'] ?? '');
        if (!empty($lines))
        {
          $line = array_shift($lines);
          $this->codeStore->append(sprintf($format, '@param', $parameter['php_type'], $parameter['php_name'], $line), false);
          foreach ($lines as $line)
          {
            $this->codeStore->append(sprintf($format, ' ', ' ', ' ', $line), false);
          }
        }
        else
        {
          $this->codeStore->append(sprintf($format, '@param', $parameter['php_type'], $parameter['php_name'], ''), false);
        }

        if ($parameter['data_type_descriptor']!==null)
        {
          $this->codeStore->append(sprintf($format, ' ', ' ', ' ', $parameter['data_type_descriptor']), false);
        }
      }
    }
  }
251653
protected function generate()
	{
		if ( $this->fields ) {
			parent::fire();

			if ( $this->log ) {
				$file = $this->datePrefix . '_' . $this->migrationName;
				$this->repository->log($file, $this->batch);
			}
		}
	}
624362
final public function generate() {
        $options = array_merge($this->options, (array) 'generate');
        Generator::call($this->called, $this->args, $options);
    }
17823
protected function generateFiles()
    {
        foreach ($this->files as $key => $file) {
            $file = $this->formatContent($file);

            $this->makeFile($key, $file);
        }
    }
141441
public function calcResourceMemorySize(): int {
		$imageData = getimagesize($this->filePath);
		
		return round(($imageData[0] * $imageData[1] * $imageData['bits'] * $imageData['channels'] / 8));
	}
712695
public function generate()
    {
        $create_at = date("YmdHis");
        $filename = sprintf("Version%s%s", $create_at, ucfirst(Str::camel('sessions')));

        $generator = new Generator(
            $this->setting->getMigrationDirectory(),
            $filename
        );

        $generator->write('model/session', [
            'className' => $filename
        ]);

        echo Color::green('Session migration created.');
    }
814470
public function data()
    {

        if ($this->plugin->bound('session')) {
            $this->attributes['paths']['sessions'] = $this->plugin->config()->get('session.files');
            $this->attributes['sizes']['sessions'] = $this->calcDiskSize($this->attributes['paths']['sessions']);
        }
        if ($this->plugin->bound('router') && $this->plugin->config()->get('routes.cache')) {
            $this->attributes['paths']['routes'] = $this->plugin->config()->get('routes.compiled');
            $this->attributes['sizes']['routes'] = $this->calcDiskSize($this->attributes['paths']['routes']);
        }
        if ($this->plugin->bound('cache')) {
            $this->attributes['paths']['objects'] = $this->plugin->config()->get('cache.stores.file.path');
            $this->attributes['sizes']['objects'] = $this->calcDiskSize($this->attributes['paths']['objects']);
        }
        $this->attributes['paths']['views'] = $this->plugin->config()->get('view.compiled');
        $this->attributes['sizes']['views'] = $this->calcDiskSize($this->attributes['paths']['views']);
    }
1139709
public function memory()
    {
        $usedInBytes   = $this->data['memory_usage']['used_memory'];
        $wastedInBytes = $this->data['memory_usage']['wasted_memory'];
        $sizeInBytes   = $usedInBytes + $wastedInBytes + $this->data['memory_usage']['free_memory'];
        return new Memory(
            $this->bytesToMb($usedInBytes),
            $this->bytesToMb($sizeInBytes),
            $this->bytesToMb($wastedInBytes)
        );
    }
72168
public function generate()
    {
        $name = $this->getName();

        if ($this->module->has($name)) {
            if ($this->force) {
                $this->module->delete($name);
            } else {
                $this->console->error("Module [{$name}] already exist!");

                return;
            }
        }

        $this->generateFolders();

        $this->generateFiles();

        if (!$this->plain) {
            $this->generateResources();
        }

        $this->console->info("Module [{$name}] created successfully.");
    }
566498
public function report()
    {
        $result = parent::aggregate();

        $result['time'] .= ' msec';

        $result['memory'] = array_map(function($v){ return $v . 'MB'; }, $result['memory']);

        ($this->callback)($result);

        $this->reported = true;
    }