Class: RubyProf::GraphPrinter

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-prof/graph_printer.rb

Overview

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.

Constant Summary collapse

PERCENTAGE_WIDTH =
8
TIME_WIDTH =
10
CALL_WIDTH =
20

Instance Method Summary collapse

Constructor Details

#initialize(result, min_percent = 0) ⇒ GraphPrinter

Create a GraphPrinter. Result is a RubyProf::Result object generated from a profiling run.



27
28
29
30
# File 'lib/ruby-prof/graph_printer.rb', line 27

def initialize(result, min_percent = 0)
 @result = result
 @min_percent = min_percent
end

Instance Method Details

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.



41
42
43
44
45
46
# File 'lib/ruby-prof/graph_printer.rb', line 41

def print(output = STDOUT, min_percent = 0)
  @output = output
  @min_percent = min_percent

    print_threads
end