Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

sys_getloadavg

Description

The sys_getloadavg of Miscellaneous for PHP gets system load average.

Syntax

sys_getloadavg ( void ) : array

Return

Returns an array with three samples (last 1, 5 and 15 minutes).

Examples

1

<?

$loadavg = sys_getloadavg();
print_r($loadavg);

?>
Array
(
    [0] => 11.48
    [1] => 14.14
    [2] => 15.6
)

2

<?

$loadavg = sys_getloadavg();
$loadmax = 5;
$sleep = 1;

if ($loadmax < $loadavg[0]) {
    sleep($sleep);
    echo "sleep $sleep second(s)";
}

?>
sleep 1 second(s)
HomeMenu