Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Latest commit

 

History

History
70 lines (50 loc) · 1.26 KB

File metadata and controls

70 lines (50 loc) · 1.26 KB

Using the tracing-framework with node.js

Tracing node applications

Quickstart

$ npm install tracing-framework
$ node
> var wtf = require('tracing-framework');
> wtf.trace.node.start();
> var scope = wtf.trace.enterScope('hello!');
> wtf.trace.leaveScope(scope);
> process.exit()
$ wtf-dump node-[time].wtf-trace

Instrumenting

See api for the wtf.trace API.

Running

Automatic injection from the shell:

# Start a snapshot-on-exit trace:
wtf-trace myscript.js [args]

Simple snapshot-on-exit:

var wtf = require('tracing-framework');
// Begin recording a trace - a snapshot will be taken upon process.exit.
wtf.trace.node.start({
  // Any options overrides; see options.md
});

Manual control:

var wtf = require('tracing-framework');

// Begin recording a trace...
wtf.trace.prepare({
  // Options
});
wtf.trace.start();

// Perform a snapshot.
wtf.trace.snapshot();

// Stop recording.
wtf.trace.stop();

Loading and processing traces

Quickstart

$ npm install tracing-framework
$ node
> var wtf = require('tracing-framework');
> var db = wtf.db.load('test.wtf-trace', function(db) {
    db.query('something');
  });

Using the Tool Runner

TODO