Class | RubyProf::GraphPrinter |
In: |
lib/ruby-prof/graph_printer.rb
|
Parent: | Object |
Generates graph profile reports as text. To use the graph printer:
result = RubyProf.profile do [code to profile] end printer = RubyProf::GraphPrinter.new(result, 5) printer.print(STDOUT, 0)
The constructor takes two arguments. The first is a RubyProf::Result object generated from a profiling run. The second is the minimum %total (the methods total time divided by the overall total time) that a method must take for it to be printed out in the report. Use this parameter to eliminate methods that are not important to the overall profiling results.
PERCENTAGE_WIDTH | = | 8 |
TIME_WIDTH | = | 10 |
CALL_WIDTH | = | 20 |
Create a GraphPrinter. Result is a RubyProf::Result object generated from a profiling run.
# File lib/ruby-prof/graph_printer.rb, line 27 27: def initialize(result, min_percent = 0) 28: @result = result 29: @min_percent = min_percent 30: end
Print a graph report to the provided output.
output - Any IO oject, including STDOUT or a file. The default value is STDOUT.
min_percent - The minimum %total (the methods total 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.
# File lib/ruby-prof/graph_printer.rb, line 41 41: def print(output = STDOUT, min_percent = 0) 42: @output = output 43: @min_percent = min_percent 44: 45: print_threads 46: end