Class: Lapine::DTrace
- Inherits:
-
Object
- Object
- Lapine::DTrace
- Defined in:
- lib/lapine/dtrace.rb
Instance Attribute Summary collapse
-
#probes ⇒ Object
readonly
Returns the value of attribute probes.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ DTrace
constructor
A new instance of DTrace.
Constructor Details
#initialize ⇒ DTrace
Returns a new instance of DTrace.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/lapine/dtrace.rb', line 7 def initialize @provider = USDT::Provider.create(:ruby, :lapine) @probes = { # args: Class name, payload dispatch_enter: provider.probe(:dispatch, :enter, :string, :string), # args: Class name, payload dispatch_return: provider.probe(:dispatch, :return, :string, :string), } end |
Instance Attribute Details
#probes ⇒ Object (readonly)
Returns the value of attribute probes.
5 6 7 |
# File 'lib/lapine/dtrace.rb', line 5 def probes @probes end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
5 6 7 |
# File 'lib/lapine/dtrace.rb', line 5 def provider @provider end |
Class Method Details
.fire!(probe_name, *args) ⇒ Object
24 25 26 27 28 |
# File 'lib/lapine/dtrace.rb', line 24 def self.fire!(probe_name, *args) raise ArgumentError.new("Unknown probe: #{probe_name}") unless self.provider.probes[probe_name] probe = self.provider.probes[probe_name] probe.fire(*args) if probe.enabled? end |
.provider ⇒ Object
18 19 20 21 22 |
# File 'lib/lapine/dtrace.rb', line 18 def self.provider @provider ||= new.tap do |p| p.provider.enable end end |