Skip to content

Instantly share code, notes, and snippets.

@xk

xk/debugger.js

Created Dec 18, 2010
Embed
What would you like to do?
debugger.js
// 2010-12-16 jorge@jorgechamorro.com
// loopFreq.js displays event loop tick period in ms and KHz
// with debugger; slows down to a crawl !
var k_ms= 1e3;
setTimeout(function display () {
t= Date.now()-t;
console.log(["ctr: ",ctr, ", t:", t, "ms -> ", (ctr/t).toFixed(2), "KHz"].join(''));
setTimeout(display, k_ms);
ctr= 0;
t= Date.now()+ 2;
while (t > Date.now()) ; //get in sync with clock
}, k_ms);
var ctr= 0;
var t= Date.now()+ 2;
while (t > Date.now()) ; //get in sync with clock
(function foo () {
debugger; // this is the problem !
process.nextTick(foo);
ctr++;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.