Sha256: 874e49d34c66d5b2e70d0d86dea6efdd4c596623bc089312d78b5c3008ce7fb4

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

module Stackprofiler
  module Filter
    class JsTree
      def filter root, frames
        addrs = root.content[:addrs]
        name = addrs.first.to_i
        frame = frames[name]

        escaped = addrs.map do |addr|
          this_frame = frames[addr.to_i]
          this_name = CGI::escapeHTML(this_frame[:name])
          "#{this_name} (<b>#{this_frame[:samples]}</b>)"
        end
        text = escaped.join("<br> ↳ ")

        children = root.children.map { |n| filter(n, frames) }
        open = frame[:total_samples] > 100
        {text: text, children: children, state: {opened: open}, icon: false, data: {addrs: addrs}}
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stackprofiler-0.0.1 lib/stackprofiler/filters/js_tree.rb