Class: StaticTracing::Tracepoint
- Inherits:
-
Object
- Object
- StaticTracing::Tracepoint
- Defined in:
- lib/ruby-static-tracing/tracepoint.rb
Defined Under Namespace
Classes: InvalidArgType, InvalidArgumentError
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.
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
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.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ruby-static-tracing/tracepoint.rb', line 25 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.
20 21 22 |
# File 'lib/ruby-static-tracing/tracepoint.rb', line 20 def args @args end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
20 21 22 |
# File 'lib/ruby-static-tracing/tracepoint.rb', line 20 def name @name end |
#provider_name ⇒ Object (readonly)
Returns the value of attribute provider_name.
20 21 22 |
# File 'lib/ruby-static-tracing/tracepoint.rb', line 20 def provider_name @provider_name end |
Instance Method Details
#enabled? ⇒ Boolean
Returns true if a tracepoint is currently attached to, indicating we should fire it
54 |
# File 'lib/ruby-static-tracing/tracepoint.rb', line 54 def enabled?; end |
#fire(*values) ⇒ Object
Fire a tracepoint, sending the data off to be received by a tracing program like dtrace
41 42 43 44 45 46 |
# File 'lib/ruby-static-tracing/tracepoint.rb', line 41 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 |