Class: ObjectSpace::AllocationSampler::Result::Frame
- Includes:
- Enumerable
- Defined in:
- lib/allocation_sampler.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#samples ⇒ Object
Returns the value of attribute samples.
-
#total_samples ⇒ Object
Returns the value of attribute total_samples.
Attributes inherited from Frame
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(frame, line, samples) ⇒ Frame
constructor
A new instance of Frame.
- #to_dot ⇒ Object
Constructor Details
#initialize(frame, line, samples) ⇒ Frame
Returns a new instance of Frame.
28 29 30 31 32 33 34 |
# File 'lib/allocation_sampler.rb', line 28 def initialize frame, line, samples super(frame) @line = line @samples = samples @total_samples = 0 @children = Set.new end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
23 24 25 |
# File 'lib/allocation_sampler.rb', line 23 def children @children end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
23 24 25 |
# File 'lib/allocation_sampler.rb', line 23 def line @line end |
#samples ⇒ Object
Returns the value of attribute samples.
24 25 26 |
# File 'lib/allocation_sampler.rb', line 24 def samples @samples end |
#total_samples ⇒ Object
Returns the value of attribute total_samples.
24 25 26 |
# File 'lib/allocation_sampler.rb', line 24 def total_samples @total_samples end |
Instance Method Details
#each ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/allocation_sampler.rb', line 36 def each seen = {} stack = [self] while node = stack.pop next if seen[node] seen[node] = true yield node stack.concat node.children.to_a end end |
#to_dot ⇒ Object
48 49 50 51 52 |
# File 'lib/allocation_sampler.rb', line 48 def to_dot seen = {} "digraph allocations {\n" + " node[shape=record];\n" + print_edges(self, seen, total_samples) + "}\n" end |