Class: RubyProf::FlameGraphJsonPrinter::FlameDataWalker
- Defined in:
- lib/ruby-prof/printers/flame_graph_json_printer.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Attributes inherited from Walker
Instance Method Summary collapse
- #enter_frame(type, obj, name, called, self_value, total_value) ⇒ Object
-
#initialize(output, threads, options = {}) ⇒ FlameDataWalker
constructor
A new instance of FlameDataWalker.
- #leave_frame(type, obj) ⇒ Object
Methods inherited from Walker
Constructor Details
#initialize(output, threads, options = {}) ⇒ FlameDataWalker
Returns a new instance of FlameDataWalker.
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ruby-prof/printers/flame_graph_json_printer.rb', line 46 def initialize(output, threads, ={}) super(threads, ) @output = output @printer = FlameDataJsonPrinter.new(@output, { depth: 1, anchored: false }) @height = 0 @depth = 0 end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
44 45 46 |
# File 'lib/ruby-prof/printers/flame_graph_json_printer.rb', line 44 def height @height end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
43 44 45 |
# File 'lib/ruby-prof/printers/flame_graph_json_printer.rb', line 43 def output @output end |
Instance Method Details
#enter_frame(type, obj, name, called, self_value, total_value) ⇒ Object
59 60 61 62 63 |
# File 'lib/ruby-prof/printers/flame_graph_json_printer.rb', line 59 def enter_frame(type, obj, name, called, self_value, total_value) @depth += 1 @height = @depth if @height < @depth @printer.enter(name, called, self_value, total_value) end |
#leave_frame(type, obj) ⇒ Object
65 66 67 68 |
# File 'lib/ruby-prof/printers/flame_graph_json_printer.rb', line 65 def leave_frame(type, obj) @printer.leave @depth -= 1 end |