Class: StaticTracing::Tracepoint
- Inherits:
-
Object
- Object
- StaticTracing::Tracepoint
- Defined in:
- lib/ruby-static-tracing/tracepoint.rb
Defined Under Namespace
Classes: InvalidArgType, InvalidArgumentError, TracepointMissingError
Constant Summary collapse
- VALID_ARGS_TYPES =
[Integer, String].freeze
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#provider_name ⇒ Object
readonly
Returns the value of attribute provider_name.
Class Method Summary collapse
-
.fetch(provider, name) ⇒ Object
Gets a trace instance by provider name and name.
Instance Method Summary collapse
-
#enabled? ⇒ Boolean
Returns true if a tracepoint is currently attached to, indicating we should fire it.
-
#fire(*values) ⇒ Object
Fire a tracepoint, sending the data off to be received by a tracing program like dtrace.
-
#initialize(provider_name, name, *args) ⇒ Tracepoint
constructor
Creates a new tracepoint.
-
#provider ⇒ Object
The provider this tracepoint is defined on.
Constructor Details
#initialize(provider_name, name, *args) ⇒ Tracepoint
Creates a new tracepoint. If a provider by the name specified doesn’t exist already, one will be added implicitly.
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ruby-static-tracing/tracepoint.rb', line 36 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 |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
31 32 33 |
# File 'lib/ruby-static-tracing/tracepoint.rb', line 31 def args @args end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
31 32 33 |
# File 'lib/ruby-static-tracing/tracepoint.rb', line 31 def name @name end |
#provider_name ⇒ Object (readonly)
Returns the value of attribute provider_name.
31 32 33 |
# File 'lib/ruby-static-tracing/tracepoint.rb', line 31 def provider_name @provider_name end |
Class Method Details
.fetch(provider, name) ⇒ Object
Gets a trace instance by provider name and name
9 10 11 12 13 |
# File 'lib/ruby-static-tracing/tracepoint.rb', line 9 def fetch(provider, name) Provider.fetch(provider).tracepoints.fetch(name.to_s) do raise TracepointMissingError end end |
Instance Method Details
#enabled? ⇒ Boolean
Returns true if a tracepoint is currently attached to, indicating we should fire it
66 |
# File 'lib/ruby-static-tracing/tracepoint.rb', line 66 def enabled?; end |
#fire(*values) ⇒ Object
Fire a tracepoint, sending the data off to be received by a tracing program like dtrace
52 53 54 55 56 57 |
# File 'lib/ruby-static-tracing/tracepoint.rb', line 52 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 |