Skip to content

Instantly share code, notes, and snippets.

@LorbusChris
Last active September 5, 2017 18:22
Show Gist options
  • Save LorbusChris/54a21cf0ca186fa76a1ed1ce70006505 to your computer and use it in GitHub Desktop.
Save LorbusChris/54a21cf0ca186fa76a1ed1ce70006505 to your computer and use it in GitHub Desktop.
function doWork () {
var timer = new Date ();
// do n cyles of work here
timer = new Date () - timer; // time spent working
setTimeout (doWork, timer); // wait an equivalent time for 50% processor load
}
also investigate:
target_cpu_utilization_percentage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment