Class: DRbQS::Test::Prof

Inherits:
Object
  • Object
show all
Defined in:
lib/drbqs/server/test/prof.rb

Constant Summary collapse

PRINTER_TYPE =
[:flat, :graph, :graphhtml, :calltree]

Instance Method Summary collapse

Constructor Details

#initialize(printer_type, output) ⇒ Prof

:flat :graph :graphhtml :calltree



12
13
14
15
16
17
18
# 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

Instance Method Details

#finishObject



38
39
40
41
42
43
44
45
46
47
# 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

#startObject



34
35
36
# File 'lib/drbqs/server/test/prof.rb', line 34

def start
  RubyProf.start
end