Class: Stackprofiler::Filter::CompressTree
- Inherits:
-
Object
- Object
- Stackprofiler::Filter::CompressTree
- Defined in:
- lib/stackprofiler/filters/compress_tree.rb
Instance Method Summary collapse
- #filter(root, run) ⇒ Object
-
#initialize(options = {}) ⇒ CompressTree
constructor
A new instance of CompressTree.
Constructor Details
#initialize(options = {}) ⇒ CompressTree
Returns a new instance of CompressTree.
4 5 6 |
# File 'lib/stackprofiler/filters/compress_tree.rb', line 4 def initialize(={}) end |
Instance Method Details
#filter(root, run) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# 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 |