aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2010-04-04 11:56:49 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2010-04-04 11:56:49 -0700
commit50cdb654ac4ff1bde2f432d205932a6887f6f92f (patch)
tree874cf691f78effb9508e7676236de00baa8e58ac
parent3e5f5f2a48a39abb2e558b2375d75dcf4a2c8acc (diff)
downloadrails-50cdb654ac4ff1bde2f432d205932a6887f6f92f.tar.gz
rails-50cdb654ac4ff1bde2f432d205932a6887f6f92f.tar.bz2
rails-50cdb654ac4ff1bde2f432d205932a6887f6f92f.zip
Use call stack printer if available
-rwxr-xr-xtools/profile10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/profile b/tools/profile
index 927467bc4e..0ccef6c26c 100755
--- a/tools/profile
+++ b/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