Advertisement
kernel

node.js: calculate ticks per second

Jul 22nd, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var ticks = 0;
  2.  
  3. (function loop() {
  4.   setImmediate(function () {
  5.     ticks += 1;
  6.     loop();
  7.   });
  8. }());
  9.  
  10. setInterval(function () {
  11.   console.log(ticks);
  12.   ticks = 0;
  13. }, 1000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement