Class: HeapScope::Runtime::Base
- Inherits:
-
Object
- Object
- HeapScope::Runtime::Base
- Defined in:
- lib/heapscope/runtime/base.rb
Overview
Shared runtime adapter interface. Implementations degrade safely.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#engine ⇒ Object
readonly
Returns the value of attribute engine.
Instance Method Summary collapse
- #allocation_info(_object) ⇒ Object
- #allocation_tracing? ⇒ Boolean
- #each_object(_klass = nil) ⇒ Object
- #each_object? ⇒ Boolean
- #gc_stat ⇒ Object
- #gc_stat? ⇒ Boolean
-
#initialize(engine: RUBY_ENGINE) ⇒ Base
constructor
A new instance of Base.
- #memsize? ⇒ Boolean
- #memsize_of(_object) ⇒ Object
- #process_metadata ⇒ Object
- #reachable_objects? ⇒ Boolean
- #reachable_objects_from(_object) ⇒ Object
- #rss_bytes ⇒ Object
- #rss_tracking? ⇒ Boolean
- #start_allocation_tracing ⇒ Object
- #stop_allocation_tracing ⇒ Object
Constructor Details
#initialize(engine: RUBY_ENGINE) ⇒ Base
Returns a new instance of Base.
9 10 11 |
# File 'lib/heapscope/runtime/base.rb', line 9 def initialize(engine: RUBY_ENGINE) @engine = engine end |
Instance Attribute Details
#engine ⇒ Object (readonly)
Returns the value of attribute engine.
7 8 9 |
# File 'lib/heapscope/runtime/base.rb', line 7 def engine @engine end |
Instance Method Details
#allocation_info(_object) ⇒ Object
70 71 72 |
# File 'lib/heapscope/runtime/base.rb', line 70 def allocation_info(_object) nil end |
#allocation_tracing? ⇒ Boolean
13 14 15 |
# File 'lib/heapscope/runtime/base.rb', line 13 def allocation_tracing? false end |
#each_object(_klass = nil) ⇒ Object
50 51 52 |
# File 'lib/heapscope/runtime/base.rb', line 50 def each_object(_klass = nil) raise CapabilityError, "ObjectSpace.each_object is unavailable on #{engine}" end |
#each_object? ⇒ Boolean
32 33 34 |
# File 'lib/heapscope/runtime/base.rb', line 32 def each_object? false end |
#gc_stat ⇒ Object
40 41 42 43 44 |
# File 'lib/heapscope/runtime/base.rb', line 40 def gc_stat return {} unless gc_stat? normalize_gc_stat(GC.stat) end |
#gc_stat? ⇒ Boolean
36 37 38 |
# File 'lib/heapscope/runtime/base.rb', line 36 def gc_stat? defined?(GC) && GC.respond_to?(:stat) end |
#memsize? ⇒ Boolean
21 22 23 |
# File 'lib/heapscope/runtime/base.rb', line 21 def memsize? false end |
#memsize_of(_object) ⇒ Object
54 55 56 |
# File 'lib/heapscope/runtime/base.rb', line 54 def memsize_of(_object) nil end |
#process_metadata ⇒ Object
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/heapscope/runtime/base.rb', line 74 def { pid: Process.pid, ppid: Process.ppid, engine: engine, ruby: RUBY_VERSION, platform: RUBY_PLATFORM, thread: Thread.current.name || Thread.current.object_id.to_s } end |
#reachable_objects? ⇒ Boolean
17 18 19 |
# File 'lib/heapscope/runtime/base.rb', line 17 def reachable_objects? false end |
#reachable_objects_from(_object) ⇒ Object
58 59 60 |
# File 'lib/heapscope/runtime/base.rb', line 58 def reachable_objects_from(_object) [] end |
#rss_bytes ⇒ Object
46 47 48 |
# File 'lib/heapscope/runtime/base.rb', line 46 def rss_bytes read_rss_bytes end |
#rss_tracking? ⇒ Boolean
25 26 27 28 29 30 |
# File 'lib/heapscope/runtime/base.rb', line 25 def rss_tracking? rss_bytes true rescue StandardError false end |
#start_allocation_tracing ⇒ Object
62 63 64 |
# File 'lib/heapscope/runtime/base.rb', line 62 def start_allocation_tracing raise CapabilityError, "Allocation tracing unavailable on #{engine}" end |
#stop_allocation_tracing ⇒ Object
66 67 68 |
# File 'lib/heapscope/runtime/base.rb', line 66 def stop_allocation_tracing nil end |