Current Location: Home> Function Categories> sys_getloadavg

sys_getloadavg

Obtain the average load of the system
Name:sys_getloadavg
Category:Miscellaneous
Programming Language:php
One-line Description:Returns the system load average.

Definition and usage

sys_getloadavg() function returns the average value of the system load.

This function returns an array of three numbers representing the average system load for the past 1 minute, 5 minutes and 15 minutes respectively.

Note: This function is not implemented on the Windows platform.

Example

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

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

grammar

 sys_getloadavg ( )
Similar Functions
Popular Articles