class RubyProf::FlatPrinter


printer.print(STDOUT, {})
printer = RubyProf::FlatPrinter.new(result)
end
[code to profile]
result = RubyProf.profile do
To use the flat printer:
Generates flat profile reports as text.

def print_column_headers

def print_column_headers
  @output << " %self      total      self      wait     child     calls  name                           location\n"
end

def print_methods(thread)

def print_methods(thread)
  total_time = thread.total_time
  methods = thread.methods.sort_by(&sort_method).reverse
  sum = 0
  methods.each do |method|
    percent = (method.send(filter_by) / total_time) * 100
    next if percent < min_percent
    next if percent > max_percent
    sum += method.self_time
    #self_time_called = method.called > 0 ? method.self_time/method.called : 0

    #total_time_called = method.called > 0? method.total_time/method.called : 0

    @output << "%6.2f  %9.3f %9.3f %9.3f %9.3f %8d  %s%-30s %s\n" % [
                  method.self_time / total_time * 100, # %self

                  method.total_time,                   # total

                  method.self_time,                    # self

                  method.wait_time,                    # wait

                  method.children_time,                # children

                  method.called,                       # calls

                  method.recursive? ? "*" : " ",       # cycle

                  method.full_name,                    # method_name]

                  method_location(method)]             # location]

  end
end

def sort_method

Override for this printer to sort by self time by default
def sort_method
  @options[:sort_method] || :self_time
end