lib/stackprof/report.rb in stackprof-0.2.4 vs lib/stackprof/report.rb in stackprof-0.2.5

- old
+ new

@@ -99,11 +99,11 @@ stacks.each do |*stack, weight| cell = stack[y] if cell.nil? if row_prev - flamegraph_row(x - row_width, y, row_width, row_prev) + flamegraph_row(f, x - row_width, y, row_width, row_prev) end row_prev = nil x += weight next @@ -117,11 +117,11 @@ elsif row_prev == cell # grow current row along x-axis row_width += weight x += weight else # end current row and start new row - flamegraph_row(x - row_width, y, row_width, row_prev) + flamegraph_row(f, x - row_width, y, row_width, row_prev) x += weight row_prev = cell row_width = weight end @@ -129,18 +129,18 @@ end if row_prev next if skip_common && row_width == max_x - flamegraph_row(x - row_width, y, row_width, row_prev) + flamegraph_row(f, x - row_width, y, row_width, row_prev) end end f.puts '])' end - def flamegraph_row(x, y, weight, addr) + def flamegraph_row(f, x, y, weight, addr) frame = frames[addr] - print ',' if @rows_started + f.print ',' if @rows_started @rows_started = true f.puts %{{"x":#{x},"y":#{y},"width":#{weight},"frame_id":#{addr},"frame":#{frame[:name].dump},"file":#{frame[:file].dump}}} end def print_graphviz(filter = nil, f = STDOUT)