Class: StaticTracing::Provider
- Inherits:
-
Object
- Object
- StaticTracing::Provider
- Defined in:
- lib/ruby-static-tracing/provider.rb,
ext/ruby-static-tracing/darwin/ruby_static_tracing.c,
ext/ruby-static-tracing/linux/ruby_static_tracing.c
Overview
Provider is the wrapper around libstapsdt
Defined Under Namespace
Classes: ProviderMissingError
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#tracepoints ⇒ Object
readonly
Returns the value of attribute tracepoints.
Class Method Summary collapse
-
.disable! ⇒ Object
Forcefully disables all providers, unloading them from memory.
-
.enable! ⇒ Object
Enables each provider, ensuring it is loaded into memeory.
-
.fetch(namespace) ⇒ Object
Gets a provider instance by name.
-
.register(namespace) ⇒ Object
Gets a provider by name or creates one if not exists.
Instance Method Summary collapse
-
#add_tracepoint(tracepoint, *args) ⇒ Object
Adds a new tracepoint to this provider FIXME - should this be a dictionary, or are duplicate names allowed?.
-
#destroy ⇒ Object
Completely removes the provider.
-
#disable ⇒ Object
Disables the provider, unloading it from memory.
-
#enable ⇒ Object
Enable the provider, loading it into memory.
-
#enabled? ⇒ Boolean
Returns true if the provider is enabled, meaning it is loaded into memory.
-
#path ⇒ Object
Only supported on systems (linux) where backed by file.
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/ruby-static-tracing/provider.rb', line 9 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
48 49 50 |
# File 'lib/ruby-static-tracing/provider.rb', line 48 def namespace @namespace end |
#tracepoints ⇒ Object (readonly)
Returns the value of attribute tracepoints.
48 49 50 |
# File 'lib/ruby-static-tracing/provider.rb', line 48 def tracepoints @tracepoints end |
Class Method Details
.disable! ⇒ Object
Forcefully disables all providers, unloading them from memory
36 37 38 |
# File 'lib/ruby-static-tracing/provider.rb', line 36 def disable! providers.values.each(&:disable) end |
.enable! ⇒ Object
Enables each provider, ensuring it is loaded into memeory
30 31 32 |
# File 'lib/ruby-static-tracing/provider.rb', line 30 def enable! providers.values.each(&:enable) end |
.fetch(namespace) ⇒ Object
Gets a provider instance by name
22 23 24 25 26 |
# File 'lib/ruby-static-tracing/provider.rb', line 22 def fetch(namespace) providers.fetch(namespace) do raise ProviderMissingError end end |
.register(namespace) ⇒ Object
Gets a provider by name or creates one if not exists
17 18 19 |
# File 'lib/ruby-static-tracing/provider.rb', line 17 def register(namespace) providers[namespace] ||= new(namespace) end |
Instance Method Details
#add_tracepoint(tracepoint, *args) ⇒ Object
Adds a new tracepoint to this provider FIXME - should this be a dictionary, or are duplicate names allowed?
52 53 54 55 56 57 58 |
# File 'lib/ruby-static-tracing/provider.rb', line 52 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 |
#destroy ⇒ Object
Completely removes the provider
80 |
# File 'lib/ruby-static-tracing/provider.rb', line 80 def destroy; end |
#disable ⇒ Object
Disables the provider, unloading it from memory
66 67 68 |
# File 'lib/ruby-static-tracing/provider.rb', line 66 def disable @enabled = !_disable_provider end |
#enable ⇒ Object
Enable the provider, loading it into memory
61 62 63 |
# File 'lib/ruby-static-tracing/provider.rb', line 61 def enable @enabled = _enable_provider end |
#enabled? ⇒ Boolean
Returns true if the provider is enabled, meaning it is loaded into memory
72 73 74 |
# File 'lib/ruby-static-tracing/provider.rb', line 72 def enabled? @enabled end |
#path ⇒ Object
Only supported on systems (linux) where backed by file
77 |
# File 'lib/ruby-static-tracing/provider.rb', line 77 def path; end |