Class: HeapProfiler::Analyzer::Dimension
- Inherits:
-
Object
- Object
- HeapProfiler::Analyzer::Dimension
- Defined in:
- lib/heap_profiler/analyzer.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#memory ⇒ Object
readonly
Returns the value of attribute memory.
-
#objects ⇒ Object
readonly
Returns the value of attribute objects.
Instance Method Summary collapse
-
#initialize ⇒ Dimension
constructor
A new instance of Dimension.
- #process(_index, object) ⇒ Object
- #stats(metric) ⇒ Object
Constructor Details
#initialize ⇒ Dimension
Returns a new instance of Dimension.
7 8 9 10 |
# File 'lib/heap_profiler/analyzer.rb', line 7 def initialize @objects = 0 @memory = 0 end |
Instance Attribute Details
#memory ⇒ Object (readonly)
Returns the value of attribute memory.
6 7 8 |
# File 'lib/heap_profiler/analyzer.rb', line 6 def memory @memory end |
#objects ⇒ Object (readonly)
Returns the value of attribute objects.
6 7 8 |
# File 'lib/heap_profiler/analyzer.rb', line 6 def objects @objects end |
Instance Method Details
#process(_index, object) ⇒ Object
12 13 14 15 |
# File 'lib/heap_profiler/analyzer.rb', line 12 def process(_index, object) @objects += 1 @memory += object[:memsize] end |
#stats(metric) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/heap_profiler/analyzer.rb', line 17 def stats(metric) case metric when "objects" objects when "memory" memory else raise "Invalid metric: #{metric.inspect}" end end |