Class: MemoryTracker::GcStatDelta
- Inherits:
-
Object
- Object
- MemoryTracker::GcStatDelta
- Defined in:
- lib/memory_tracker/gc_stat.rb
Instance Attribute Summary collapse
-
#stats ⇒ Object
readonly
Returns the value of attribute stats.
Instance Method Summary collapse
- #custom ⇒ Object
-
#initialize(before, after) ⇒ GcStatDelta
constructor
A new instance of GcStatDelta.
Constructor Details
#initialize(before, after) ⇒ GcStatDelta
Returns a new instance of GcStatDelta.
98 99 100 101 102 103 104 |
# File 'lib/memory_tracker/gc_stat.rb', line 98 def initialize(before, after) @after = after @stats = after.inject({}) do |h, (k, v)| h[k] = after[k] - before[k] h end end |
Instance Attribute Details
#stats ⇒ Object (readonly)
Returns the value of attribute stats.
96 97 98 |
# File 'lib/memory_tracker/gc_stat.rb', line 96 def stats @stats end |
Instance Method Details
#custom ⇒ Object
106 107 108 109 110 111 112 113 114 115 |
# File 'lib/memory_tracker/gc_stat.rb', line 106 def custom return unless stats[:total_allocated_object] && stats[:total_freed_object] h = {} h[:total_allocated_object] = stats[:total_allocated_object] h[:count] = stats[:count] h[:rss] = stats[:rss] h[:heap_used] = @after[:heap_used] h[:in_use] = @after[:total_allocated_object] - @after[:total_freed_object] h end |