Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dtrace-provider.js 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. var DTraceProvider;
  2. function DTraceProviderStub() {}
  3. DTraceProviderStub.prototype.addProbe = function(name) {
  4. var p = { 'fire': function () {} };
  5. this[name] = p;
  6. return (p);
  7. };
  8. DTraceProviderStub.prototype.enable = function() {};
  9. DTraceProviderStub.prototype.fire = function() {};
  10. DTraceProviderStub.prototype.disable = function() {};
  11. var builds = ['Release', 'default', 'Debug'];
  12. var err = null;
  13. for (var i = 0; i < builds.length; i++) {
  14. try {
  15. var binding = require('./src/build/' + builds[i] + '/DTraceProviderBindings');
  16. DTraceProvider = binding.DTraceProvider;
  17. break;
  18. } catch (e) {
  19. if (err === null) {
  20. err = e;
  21. }
  22. }
  23. }
  24. if (!DTraceProvider) {
  25. if (process.env.NODE_DTRACE_PROVIDER_REQUIRE === 'hard') {
  26. throw err;
  27. } else {
  28. DTraceProvider = DTraceProviderStub;
  29. }
  30. }
  31. exports.DTraceProvider = DTraceProvider;
  32. exports.createDTraceProvider = function(name, module) {
  33. if (arguments.length == 2)
  34. return (new exports.DTraceProvider(name, module));
  35. return (new exports.DTraceProvider(name));
  36. };