Last active
February 18, 2016 14:58
-
-
Save TheShrike/ab1dff5446a560165073 to your computer and use it in GitHub Desktop.
Php keep CPU load low in heavy script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sleep_check_load($sleep, $load) | |
{ | |
$done = FALSE; | |
while ($done == FALSE) { | |
sleep($sleep); | |
$load_avg = sys_getloadavg(); | |
if ($load_avg[1] < $load) { | |
$done = TRUE; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment