class Stackprofiler::Filter::CompressTree
Public Class Methods
new(options={})
click to toggle source
# File lib/stackprofiler/filters/compress_tree.rb, line 4 def initialize(options={}) end
Public Instance Methods
filter(root, run)
click to toggle source
# File lib/stackprofiler/filters/compress_tree.rb, line 8 def filter root, run root.reverse_depth_first do |node| if node.out_degree == 1 hash = node.content hash[:addrs] += node.first_child.content[:addrs] repl = Tree::TreeNode.new(node.name, hash) node.first_child.children.each {|n| repl << n } node.replace_with repl end end root end