Jarves\Controller\Admin\DashboardWidgets::getRamSize PHP Method

getRamSize() public method

public getRamSize ( ) : integer
return integer kB
    public function getRamSize()
    {
        if ('darwin' == strtolower(PHP_OS)) {
            $sysctl = `/usr/sbin/sysctl hw.memsize`;
            preg_match('/hw.memsize: ([0-9\\.]*)/', $sysctl, $matches);
            if (!$matches) {
                return 0;
            }
            return ($matches[1] + 0) / 1024;
        } else {
            if ('linux' === strtolower(PHP_OS)) {
                $sysctl = `free`;
                $matches = array();
                preg_match('/Mem:\\s+([0-9\\.]*)/', $sysctl, $matches);
                return $matches[1] + 0;
            }
        }
        return 1;
    }