class StaticTracing::Provider
A wrapper for a USDT tracepoint provider This corresponds to a namespace of tracepoints By convention, we will often create one per class or module.
Attributes
Public Class Methods
Forcefully disables all providers, unloading them from memory
# File lib/ruby-static-tracing/provider.rb, line 35 def disable! providers.values.each(&:disable) end
Enables each provider, ensuring it is loaded into memeory
# File lib/ruby-static-tracing/provider.rb, line 29 def enable! providers.values.each(&:enable) end
Gets a provider instance by name
# File lib/ruby-static-tracing/provider.rb, line 21 def fetch(namespace) providers.fetch(namespace) do raise ProviderMissingError end end
ALWAYS use register, never call .new dilectly
# File lib/ruby-static-tracing/provider.rb, line 84 def initialize(namespace) if StaticTracing::Platform.supported_platform? provider_initialize(namespace) @enabled = false else StaticTracing.issue_disabled_tracepoints_warning end @namespace = namespace @tracepoints = {} end
Gets a provider by name or creates one if not exists
# File lib/ruby-static-tracing/provider.rb, line 16 def register(namespace) providers[namespace] ||= new(namespace) end
Public Instance Methods
Adds a new tracepoint to this provider FIXME - should this be a dictionary, or are duplicate names allowed?
# File lib/ruby-static-tracing/provider.rb, line 51 def add_tracepoint(tracepoint, *args) if tracepoint.is_a?(String) tracepoint = Tracepoint.new(namespace, tracepoint, *args) elsif tracepoint.is_a?(Tracepoint) @tracepoints[tracepoint.name] = tracepoint end end
Completely removes the provider
# File lib/ruby-static-tracing/provider.rb, line 79 def destroy; end
Disables the provider, unloading it from memory
# File lib/ruby-static-tracing/provider.rb, line 65 def disable @enabled = !_disable_provider end
Enable the provider, loading it into memory
# File lib/ruby-static-tracing/provider.rb, line 60 def enable @enabled = _enable_provider end
Returns true if the provider is enabled, meaning it is loaded into memory
# File lib/ruby-static-tracing/provider.rb, line 71 def enabled? @enabled end
Only supported on systems (linux) where backed by file
# File lib/ruby-static-tracing/provider.rb, line 76 def path; end