Class: Dtrace::Provider

Inherits:
Object
  • Object
show all
Defined in:
lib/xray/dtrace/usdt/provider_extensions.rb

Instance Method Summary collapse

Instance Method Details

#loadObject



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
# File 'lib/xray/dtrace/usdt/provider_extensions.rb', line 14

def load
  provider_module = original_load
  
  xray_extension_module = Module.new do
    @@provider_module = provider_module
    
    def firing(function_prefix, *args)
      @@provider_module.send :"#{function_prefix}_start" do |probe|
        probe.fire(*args)
      end
      result = yield
      @@provider_module.send :"#{function_prefix}_end" do |probe|
        probe.fire(*args)
      end
      result
    end

    def fire(function_name, *args)
      @@provider_module.send function_name do |p|
        p.fire(*args)
      end
    end

  end
          
  provider_module.const_set :XRay, xray_extension_module
  provider_module     
end

#original_loadObject



13
# File 'lib/xray/dtrace/usdt/provider_extensions.rb', line 13

alias :original_load :load