From 54f2d1d944bb7577ef33ab086191992210f4788c Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 30 Apr 2005 15:37:45 +0000 Subject: Added console --profile for profiling an IRB session #1154 [bitsweat]. Changed console_sandbox into console --sandbox #1154 [bitsweat] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1261 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/lib/console_profile.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 railties/lib/console_profile.rb (limited to 'railties/lib/console_profile.rb') diff --git a/railties/lib/console_profile.rb b/railties/lib/console_profile.rb new file mode 100644 index 0000000000..afec28795d --- /dev/null +++ b/railties/lib/console_profile.rb @@ -0,0 +1,14 @@ +# No GC nonsense. +GC.disable + +# Try to load the ruby-prof extension; fail back to the pure-Ruby +# profiler included in the standard library. +begin + require 'prof' + Prof.clock_mode = Prof::CPU + puts 'Using the fast ruby-prof extension' + require 'unprof' +rescue LoadError + puts 'Using the slow pure-Ruby profiler' + require 'profile' +end -- cgit v1.2.3