Module: StaticTracing
- Extended by:
- StaticTracing
- Included in:
- StaticTracing
- Defined in:
- lib/ruby-static-tracing.rb,
lib/ruby-static-tracing/version.rb,
lib/ruby-static-tracing/platform.rb,
lib/ruby-static-tracing/provider.rb,
lib/ruby-static-tracing/tracepoint.rb,
lib/ruby-static-tracing/configuration.rb,
lib/ruby-static-tracing/tracers/latency_tracer.rb,
lib/ruby-static-tracing/tracers/concerns/latency_tracer.rb
Overview
FIXME Including StaticTracing should cause every method in a module or class to be registered Implement this by introspecting all methods on the includor, and wrapping them.
Defined Under Namespace
Modules: Platform, Tracers Classes: Configuration, InternalError, Provider, SyscallError, Tracepoint
Constant Summary collapse
- BaseError =
Class.new(StandardError)
- USDTError =
Class.new(BaseError)
- VERSION =
'0.0.2'
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
- #configure {|Configuration.instance| ... } ⇒ Object
-
#disable! ⇒ Object
Overwrite the definition of all functions to their original definition, no longer wrapping them.
-
#enable! ⇒ Object
Overwrite the definition of all functions that are enabled with a wrapped version that has tracing enabled.
-
#enabled? ⇒ Boolean
Should indicate if static tracing is enabled - a global constant.
- #issue_disabled_tracepoints_warning ⇒ Object
-
#nsec ⇒ Object
Efficiently return the current monotonic clocktime.
-
#providers ⇒ Object
Retrieves a hash of all registered providers.
- #toggle_tracing! ⇒ Object
- #tracers ⇒ Object
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
21 22 23 |
# File 'lib/ruby-static-tracing.rb', line 21 def logger @logger end |
Instance Method Details
#configure {|Configuration.instance| ... } ⇒ Object
70 71 72 |
# File 'lib/ruby-static-tracing.rb', line 70 def configure yield Configuration.instance end |
#disable! ⇒ Object
Overwrite the definition of all functions to their original definition, no longer wrapping them
53 54 55 |
# File 'lib/ruby-static-tracing.rb', line 53 def disable! @enabled = false end |
#enable! ⇒ Object
Overwrite the definition of all functions that are enabled with a wrapped version that has tracing enabled
46 47 48 49 |
# File 'lib/ruby-static-tracing.rb', line 46 def enable! tracers.each(&:enable!) @enabled = true end |
#enabled? ⇒ Boolean
Should indicate if static tracing is enabled - a global constant
40 41 42 |
# File 'lib/ruby-static-tracing.rb', line 40 def enabled? !!@enabled end |
#issue_disabled_tracepoints_warning ⇒ Object
25 26 27 28 29 |
# File 'lib/ruby-static-tracing.rb', line 25 def issue_disabled_tracepoints_warning return if defined?(@warning_issued) @warning_issued = true logger.info("USDT tracepoints are not presently supported supported on #{RUBY_PLATFORM} - all operations will no-op") end |
#nsec ⇒ Object
Efficiently return the current monotonic clocktime. Wraps libc clock_gettime The overhead of this is tested to be on the order of 10 microseconds under normal conditions You should inline this method in your tracer to avoid an extra method call.
35 36 37 |
# File 'lib/ruby-static-tracing.rb', line 35 def nsec Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond) end |
#providers ⇒ Object
Retrieves a hash of all registered providers
58 59 60 |
# File 'lib/ruby-static-tracing.rb', line 58 def providers @providers ||= {} end |
#toggle_tracing! ⇒ Object
66 67 68 |
# File 'lib/ruby-static-tracing.rb', line 66 def toggle_tracing! enabled? ? disable! : enable! end |
#tracers ⇒ Object
62 63 64 |
# File 'lib/ruby-static-tracing.rb', line 62 def tracers @tracers ||= [] end |