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.
105 106 107 108 109 110 111 |
# File 'lib/memory_tracker/gc_stat.rb', line 105 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.
103 104 105 |
# File 'lib/memory_tracker/gc_stat.rb', line 103 def stats @stats end |
Instance Method Details
#custom ⇒ Object
113 114 115 116 117 118 119 120 121 122 |
# File 'lib/memory_tracker/gc_stat.rb', line 113 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 |