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 15 def initialize(result) 16 @result = result 17 @output = nil 18 end
Public Instance Methods
filter_by()
click to toggle source
Returns the method to filter methods by (when using min_percent
and max_percent
)
# File lib/ruby-prof/printers/abstract_printer.rb 31 def filter_by 32 @options[:filter_by] || :self_time 33 end
max_percent()
click to toggle source
Returns the max_percent
of time a method can take to be included in a profiling report
# File lib/ruby-prof/printers/abstract_printer.rb 26 def max_percent 27 @options[:max_percent] || 100 28 end
min_percent()
click to toggle source
Returns the min_percent
of time a method must take to be included in a profiling report
# File lib/ruby-prof/printers/abstract_printer.rb 21 def min_percent 22 @options[:min_percent] || 0 23 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
# File lib/ruby-prof/printers/abstract_printer.rb 63 def print(output = STDOUT, options = {}) 64 @output = output 65 setup_options(options) 66 print_threads 67 end
sort_method()
click to toggle source
Returns how profile data should be sorted
# File lib/ruby-prof/printers/abstract_printer.rb 41 def sort_method 42 @options[:sort_method] 43 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 36 def time_format 37 '%A, %B %-d at %l:%M:%S %p (%Z)' 38 end