Module: StaticTracing

Extended by:
StaticTracing
Included in:
StaticTracing
Defined in:
lib/ruby-static-tracing.rb,
lib/ruby-static-tracing/tracers.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/tracepoints.rb,
lib/ruby-static-tracing/tracer/base.rb,
lib/ruby-static-tracing/tracer/stack.rb,
lib/ruby-static-tracing/configuration.rb,
lib/ruby-static-tracing/tracer/helpers.rb,
lib/ruby-static-tracing/tracer/latency.rb,
lib/ruby-static-tracing/tracer/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, Tracer Classes: Configuration, InternalError, Provider, SyscallError, Tracepoint, Tracepoints, Tracers

Constant Summary collapse

BaseError =
Class.new(StandardError)
USDTError =
Class.new(BaseError)
VERSION =
'0.0.9'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



23
24
25
# File 'lib/ruby-static-tracing.rb', line 23

def logger
  @logger
end

Instance Method Details

#configure {|Configuration.instance| ... } ⇒ Object

Yields:



66
67
68
# File 'lib/ruby-static-tracing.rb', line 66

def configure
  yield Configuration.instance
end

#disable!Object

Overwrite the definition of all functions to their original definition, no longer wrapping them



56
57
58
59
60
# File 'lib/ruby-static-tracing.rb', line 56

def disable!
  StaticTracing::Tracers.disable!
  StaticTracing::Provider.disable!
  @enabled = false
end

#enable!Object

Overwrite the definition of all functions that are enabled with a wrapped version that has tracing enabled



48
49
50
51
52
# File 'lib/ruby-static-tracing.rb', line 48

def enable!
  StaticTracing::Tracers.enable!
  StaticTracing::Provider.enable!
  @enabled = true
end

#enabled?Boolean

Should indicate if static tracing is enabled - a global constant

Returns:

  • (Boolean)


42
43
44
# File 'lib/ruby-static-tracing.rb', line 42

def enabled?
  !!@enabled
end

#issue_disabled_tracepoints_warningObject



27
28
29
30
31
# File 'lib/ruby-static-tracing.rb', line 27

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

#nsecObject

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.



37
38
39
# File 'lib/ruby-static-tracing.rb', line 37

def nsec
  Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond)
end

#toggle_tracing!Object



62
63
64
# File 'lib/ruby-static-tracing.rb', line 62

def toggle_tracing!
  enabled? ? disable! : enable!
end