class Flows::Plugin::Profiler::Report::Flat

Flat report. Merges similar calls, hides execution structure.

It's a variation of a {Rport::Tree} where all calls of the same method are combined into a one first-level entry.

@example

Flows::Plugin::Profiler.profile(:flat) do
  # some code here
end

puts Flows::Plugin::Profiler.last_report

Public Instance Methods

to_a() click to toggle source
# File lib/flows/plugin/profiler/report/flat.rb, line 19
def to_a
  method_reports.map(&:to_h)
end
to_s() click to toggle source
# File lib/flows/plugin/profiler/report/flat.rb, line 23
def to_s
  method_reports.map(&:to_s).join("\n")
end

Private Instance Methods

method_reports() click to toggle source
# File lib/flows/plugin/profiler/report/flat.rb, line 29
def method_reports
  @method_reports ||= root_calculated_node
                      .group_by_subject
                      .values
                      .map { |nodes| MethodReport.new(root_calculated_node, *nodes) }
                      .sort_by(&:total_self_ms)
                      .reverse
end