class DRbQS::Test::Prof

Constants

PRINTER_TYPE

Public Class Methods

new(printer_type, output) click to toggle source

:flat :graph :graphhtml :calltree

# File lib/drbqs/server/test/prof.rb, line 12
def initialize(printer_type, output)
  @printer_type = printer_type
  unless PRINTER_TYPE.include?(@printer_type)
    raise "Invalid printer type: #{@printer_type.inspect}"
  end
  @output = output
end

Public Instance Methods

finish() click to toggle source
# File lib/drbqs/server/test/prof.rb, line 38
def finish
  printer = get_printer(RubyProf.stop)
  if IO === @output
    printer.print(@output)
  else
    Kernel.open(@output, 'w') do |f|
      printer.print(f)
    end
  end
end
start() click to toggle source
# File lib/drbqs/server/test/prof.rb, line 34
def start
  RubyProf.start
end

Private Instance Methods

get_printer(result) click to toggle source
# File lib/drbqs/server/test/prof.rb, line 20
def get_printer(result)
  case @printer_type
  when :flat
    RubyProf::FlatPrinter.new(result)
  when :graph
    RubyProf::GraphPrinter.new(result)
  when :graphhtml
    RubyProf::GraphHtmlPrinter.new(result)
  when :calltree
    RubyProf::CallTreePrinter.new(result)
  end
end