Skip to content
This repository
Browse code

Use call stack printer if available

  • Loading branch information...
commit 50cdb654ac4ff1bde2f432d205932a6887f6f92f 1 parent 3e5f5f2
Jeremy Kemper jeremy authored

Showing 1 changed file with 8 additions and 2 deletions. Show diff stats Hide diff stats

  1. +8 2 tools/profile
10 tools/profile
@@ -60,8 +60,14 @@ after = GC.allocated_size
60 60 usage = (after - before) / 1024.0
61 61
62 62 if mode
63   - File.open("#{File.basename(path, '.rb')}.#{mode}.callgrind", 'w') do |out|
64   - RubyProf::CallTreePrinter.new(results).print(out)
  63 + if RubyProf.const_defined?(:CallStackPrinter)
  64 + File.open("#{File.basename(path, '.rb')}.#{mode}.html", 'w') do |out|
  65 + RubyProf::CallStackPrinter.new(results).print(out)
  66 + end
  67 + else
  68 + File.open("#{File.basename(path, '.rb')}.#{mode}.callgrind", 'w') do |out|
  69 + RubyProf::CallTreePrinter.new(results).print(out)
  70 + end
65 71 end
66 72 end
67 73

0 comments on commit 50cdb65

Please sign in to comment.
Something went wrong with that request. Please try again.