class StaticTracing::Tracepoint

Constants

VALID_ARGS_TYPES

Attributes

args[R]
name[R]
provider_name[R]

Public Class Methods

fetch(provider, name) click to toggle source

Gets a trace instance by provider name and name

# File lib/ruby-static-tracing/tracepoint.rb, line 8
def fetch(provider, name)
  Provider.fetch(provider).tracepoints.fetch(name.to_s) do
    raise TracepointMissingError
  end
end
new(provider_name, name, *args) click to toggle source

Creates a new tracepoint. If a provider by the name specified doesn't exist already, one will be added implicitly.

# File lib/ruby-static-tracing/tracepoint.rb, line 35
def initialize(provider_name, name, *args)
  @provider_name = provider_name
  @name = name
  validate_args(args)
  @args = args

  if StaticTracing::Platform.supported_platform?
    tracepoint_initialize(provider_name, name, args)
    provider.add_tracepoint(self)
  else
    StaticTracing.issue_disabled_tracepoints_warning
  end
end

Public Instance Methods

enabled?() click to toggle source

Returns true if a tracepoint is currently attached to, indicating we should fire it

# File lib/ruby-static-tracing/tracepoint.rb, line 65
def enabled?; end
fire(*values) click to toggle source

Fire a tracepoint, sending the data off to be received by a tracing program like dtrace

# File lib/ruby-static-tracing/tracepoint.rb, line 51
def fire(*values)
  values.each_with_index do |arg, i|
    raise InvalidArgumentError.new(arg, args[i]) unless arg.is_a?(args[i])
  end
  _fire_tracepoint(values)
end
provider() click to toggle source

The provider this tracepoint is defined on

# File lib/ruby-static-tracing/tracepoint.rb, line 59
def provider
  Provider.fetch(@provider_name)
end