Skip to content

Instantly share code, notes, and snippets.

@chrisa
Created January 26, 2011 21:57
Show Gist options
  • Select an option

  • Save chrisa/797561 to your computer and use it in GitHub Desktop.

Select an option

Save chrisa/797561 to your computer and use it in GitHub Desktop.
// javascript:
var d = require('./lib/dtprovider');
var dtp = d.createDTraceProvider("nodeapp");
dtp.addProbe("probe1", "int");
dtp.addProbe("probe2", "char *");
dtp.enable();
dtp.fire("probe1", function(p) { return 42; });
dtp.fire("probe2", function(p) { return "hello, dtrace"; });
// and then:
$ sudo dtrace -Z -n 'nodeapp*:::probe1{ trace(arg0); }' \
-n 'nodeapp*:::probe2{ trace(copyinstr(arg0)); }'
dtrace: description 'nodeapp*:::probe1' matched 0 probes
dtrace: description 'nodeapp*:::probe2' matched 0 probes
CPU ID FUNCTION:NAME
0 23641 func:probe1 42
0 23642 func:probe2 hello, dtrace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment