Guest User

Untitled

a guest
Oct 17th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. var cpuMeasurement = function (timeFrame) { // timeFrame in milliseconds
  2. var cpum = 0;
  3.  
  4. var start = new Date().getTime();
  5. var end = new Date().getTime();
  6.  
  7. while (end - start < timeFrame) {
  8. cpum++;
  9. end = new Date().getTime();
  10. }
  11.  
  12. return cpum;
  13. };
  14.  
  15. console.log(cpuMeasurement(20));
Add Comment
Please, Sign In to add comment