Class: HeapProfiler::Analyzer
- Inherits:
-
Object
- Object
- HeapProfiler::Analyzer
- Defined in:
- lib/heap_profiler/analyzer.rb
Defined Under Namespace
Classes: ClassGroupDimension, Dimension, FileGroupDimension, GemGroupDimension, GroupedDimension, LocationGroupDimension, ShapeEdgeDimension, StringDimension
Instance Method Summary collapse
-
#initialize(heap, index) ⇒ Analyzer
constructor
A new instance of Analyzer.
- #run(metrics, groupings) ⇒ Object
Constructor Details
#initialize(heap, index) ⇒ Analyzer
Returns a new instance of Analyzer.
205 206 207 208 |
# File 'lib/heap_profiler/analyzer.rb', line 205 def initialize(heap, index) @heap = heap @index = index end |
Instance Method Details
#run(metrics, groupings) ⇒ Object
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/heap_profiler/analyzer.rb', line 210 def run(metrics, groupings) dimensions = {} metrics.each do |metric| if metric == "strings" dimensions["strings"] = StringDimension.new elsif metric == "shape_edges" dimensions["shape_edges"] = ShapeEdgeDimension.new else dimensions["total"] = Dimension.new groupings.each do |grouping| dimensions[grouping] = GroupedDimension.build(grouping) end end end processors = dimensions.values @heap.each_object do |object| processors.each { |p| p.process(@index, object) } end dimensions end |