Sha256: 38650f6c6cd47ea44032f75fb2912771d775b205a7fe17dd522c868c6ba543a0

Contents?: true

Size: 938 Bytes

Versions: 3

Compression:

Stored size: 938 Bytes

Contents

require File.expand_path(File.dirname(__FILE__)) + '/usdt'

puts "## Provider"
provider = USDT::Provider.create :ruby, :test
puts provider

puts
puts "## Probe with sym definition"
probe = provider.probe(:myfn, :probe,
                   :string, :string, :integer)
puts probe
puts "probe.function: #{probe.function.inspect}"
puts "probe.name: #{probe.name.inspect}"
puts "probe.arguments: #{probe.arguments.inspect}"

puts
puts "## Probe with string definition"
probe_str = provider.probe('myfn', 'str', :string)
puts probe_str
puts "probe.function: #{probe_str.function.inspect}"
puts "probe.name: #{probe_str.name.inspect}"
puts "probe.arguments: #{probe_str.arguments.inspect}"

provider.enable

puts
puts "run:\nsudo dtrace -n 'ruby*:test:myfn:probe { printf(\"%s %s %d\",
  copyinstr(arg0),
  copyinstr(arg1),
  args[2])
}'"

while true
  if probe.enabled? 
    probe.fire("one", "two", 3)
    puts("Fired!")
  end
  sleep 0.5
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-usdt-0.2.2 ext/usdt/test.rb
ruby-usdt-0.2.1 ext/usdt/test.rb
ruby-usdt-0.2.0 ext/usdt/test.rb