public static function loadAverage()
    {
        $load = 0;
        if (stristr(PHP_OS, 'win')) {
            // its not a better solution, but no other way to do this
            $cmd = "wmic cpu get loadpercentage /all";
            @exec($cmd, $output);

            // if output is exist
            if ($output) {
                // try to find line with numeric data
                foreach ($output as $line) {
                    if ($line && preg_match("/^[0-9]+\$/", $line)) {
                        $load = $line;
                        break;
                    }
                }
            }
        } else {
            $sys_load = sys_getloadavg(); // get linux load average (1 = 100% of 1 CPU)
            $load = $sys_load[0] * 100; // to percentage
        }

        if ((int)$load <= 0) {
            return 'error';
        }

        return (int)$load . '%';
    }