Sha256: 1de3f9df20264e3922ec36f2f23f1bd0190946b53e82b83b8f8709458d7574cc
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
module Stackprofiler module Filter class BuildTree def initialize(options={}) @options = options end def filter run, run2 stacks = run.stacks root = StandardWarning.disable { Tree::TreeNode.new '(Root)', {addrs: [], open: true} } stacks.each do |stack| prev = root iterate stack do |addr| # nobody likes hacks, but this halved the page rendering time node = prev.instance_variable_get(:@children_hash)[addr] if node.nil? hash = {count: 0, addrs: [addr]} node = StandardWarning.disable { Tree::TreeNode.new(addr, hash) } prev << node end node.content[:count] +=1 prev = node end end if inverted? root.children.each {|n| n.content[:open] = false } end root end def inverted? @options[:invert] end def iterate stack, &blk if inverted? stack.reverse_each &blk else stack.each &blk end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stackprofiler-0.0.4 | lib/stackprofiler/filters/build_tree.rb |