class ObjectSpace::AllocationSampler::Result::Frame
Attributes
children[R]
line[R]
samples[RW]
total_samples[RW]
Public Class Methods
new(frame, line, samples)
click to toggle source
Calls superclass method
# File lib/allocation_sampler.rb, line 27 def initialize frame, line, samples super(frame) @line = line @samples = samples @total_samples = 0 @children = Set.new end
Public Instance Methods
each() { |node| ... }
click to toggle source
# File lib/allocation_sampler.rb, line 35 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()
click to toggle source
# File lib/allocation_sampler.rb, line 47 def to_dot seen = {} "digraph allocations {\n" + " node[shape=record];\n" + print_edges(self, seen, total_samples) + "}\n" end
Private Instance Methods
print_edges(node, seen, total_samples)
click to toggle source
# File lib/allocation_sampler.rb, line 55 def print_edges node, seen, total_samples return '' if seen[node.id] seen[node.id] = node " #{node.id} [label=\"#{CGI.escapeHTML node.name}\"];\n" + node.children.map { |child| ratio = child.total_samples / total_samples.to_f width = (1 * ratio) + 1 " #{node.id} -> #{child.id} [penwidth=#{width}];\n" + print_edges(child, seen, total_samples) }.join end