Browse files

Use call stack printer if available

  • Loading branch information...
1 parent 3e5f5f2 commit 50cdb654ac4ff1bde2f432d205932a6887f6f92f @jeremy jeremy committed Apr 4, 2010
Showing with 8 additions and 2 deletions.
  1. +8 −2 tools/profile
View
10 tools/profile
@@ -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

0 comments on commit 50cdb65

Please sign in to comment.