fondue
Collect real-time JavaScript traces (number of times a function has been called, locations where exceptions have been thrown, etc).
Easily instrument an entire program with node-theseus.
Plain objects are returned from all API calls so that they can be passed around as JSON. node-theseus does this with a WebSocket. Theseus does it over Chrome's Remote Debugging API (which boils down to a WebSocket).
Install
npm install fondue
Documentation
http://adobe-research.github.io/fondue/
Use
Execute instrumented code:
var fondue = vm = ; var src = fondue;var sandbox = __tracer: undefined console: console require: require ;var output = vm;var tracer = sandbox__tracer; // created by fondue when instrumented code is run
Track trace points (functions, call sites, etc):
var functions = {};var nodesHandle = tracer;tracer; var fooNode = functions'foo';console; // call tracer.newNodes() periodically if you expect new code to be required over time
Track hit counts:
// check how many times trace points have been hitvar hitsHandle = tracer;var hits1 = tracer;console; // call repeatedly to track hit counts over timevar hits2 = tracer;console;
Access function arguments and return values (and unhandled exceptions):
var logHandle = tracer;var invocations = tracer;console;console;