Use call stack printer if available

This commit is contained in:
Jeremy Kemper 2010-04-04 11:56:49 -07:00
parent 3e5f5f2a48
commit 50cdb654ac
1 changed files with 8 additions and 2 deletions

View File

@ -60,8 +60,14 @@ after = GC.allocated_size
usage = (after - before) / 1024.0
if mode
File.open("#{File.basename(path, '.rb')}.#{mode}.callgrind", 'w') do |out|
RubyProf::CallTreePrinter.new(results).print(out)
if RubyProf.const_defined?(:CallStackPrinter)
File.open("#{File.basename(path, '.rb')}.#{mode}.html", 'w') do |out|
RubyProf::CallStackPrinter.new(results).print(out)
end
else
File.open("#{File.basename(path, '.rb')}.#{mode}.callgrind", 'w') do |out|
RubyProf::CallTreePrinter.new(results).print(out)
end
end
end