PHP sys_getloadavg() Function

❮ PHP Misc Reference

Example

Check the system load average. If it is over 0.8, stop script and display a message:

<?php
$loadtime = sys_getloadavg();
if ($loadtime[0] > 0.80) {
  die('Sorry, server is busy.');
}
?>


Definition and Usage

The sys_getloadavg() function returns the system load average.

This function returns an array with three numbers that represents the average system load over the last 1, 5 and 15 minutes.

Note: This function does not work on Windows platforms.


Syntax

sys_getloadavg()

Technical Details

Return Value: Returns an array with three samples (last 1, 5 and 15 minutes)
PHP Version: 5.1.3+

❮ PHP Misc Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.