class RubyProf::AbstractPrinter

This is the base class for all Printers. It is never used directly.

Public Class Methods

new(result) click to toggle source

Create a new printer.

result should be the output generated from a profiling run

# File lib/ruby-prof/printers/abstract_printer.rb, line 15
def initialize(result)
  @result = result
  @output = nil
end

Public Instance Methods

min_percent() click to toggle source

Returns the min_percent of total time a method must take to be included in a profiling report

# File lib/ruby-prof/printers/abstract_printer.rb, line 21
def min_percent
  @options[:min_percent] || 0
end
print(output = STDOUT, options = {}) click to toggle source

Prints a report to the provided output.

output - Any IO object, including STDOUT or a file. The default value is STDOUT.

options - Hash of print options. Note that each printer can define its own set of options.

:min_percent - Number 0 to 100 that specifes the minimum
               %self (the methods self time divided by the
               overall total time) that a method must take
               for it to be printed out in the report.
               Default value is 0.

:sort_method - Specifies method used for sorting method infos.
               Available values are :total_time, :self_time,
               :wait_time, :children_time
               Default value is :total_time
sort_method() click to toggle source

Returns how profile data should be sorted

# File lib/ruby-prof/printers/abstract_printer.rb, line 31
def sort_method
  @options[:sort_method]
end
time_format() click to toggle source

Returns the time format used to show when a profile was run

# File lib/ruby-prof/printers/abstract_printer.rb, line 26
def time_format
  '%A, %B %-d at %l:%M:%S %p (%Z)'
end