-
Notifications
You must be signed in to change notification settings - Fork 68
/
dtrace-provider.js
41 lines (36 loc) · 1.08 KB
/
dtrace-provider.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var DTraceProvider;
function DTraceProviderStub() {}
DTraceProviderStub.prototype.addProbe = function(name) {
var p = { 'fire': function () {} };
this[name] = p;
return (p);
};
DTraceProviderStub.prototype.enable = function() {};
DTraceProviderStub.prototype.fire = function() {};
DTraceProviderStub.prototype.disable = function() {};
var builds = ['Release', 'default', 'Debug'];
var err = null;
for (var i = 0; i < builds.length; i++) {
try {
var binding = require('./src/build/' + builds[i] + '/DTraceProviderBindings');
DTraceProvider = binding.DTraceProvider;
break;
} catch (e) {
if (err === null) {
err = e;
}
}
}
if (!DTraceProvider) {
if (process.env.NODE_DTRACE_PROVIDER_REQUIRE === 'hard') {
throw err;
} else {
DTraceProvider = DTraceProviderStub;
}
}
exports.DTraceProvider = DTraceProvider;
exports.createDTraceProvider = function(name, module) {
if (arguments.length == 2)
return (new exports.DTraceProvider(name, module));
return (new exports.DTraceProvider(name));
};