diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-30 15:37:45 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-30 15:37:45 +0000 |
commit | 54f2d1d944bb7577ef33ab086191992210f4788c (patch) | |
tree | 2362ded764df45f2d931cfe4d5f665f580067894 /railties/lib/console_profile.rb | |
parent | e6f3e5d90017f3f642dd2f4205679cc861a8a2ab (diff) | |
download | rails-54f2d1d944bb7577ef33ab086191992210f4788c.tar.gz rails-54f2d1d944bb7577ef33ab086191992210f4788c.tar.bz2 rails-54f2d1d944bb7577ef33ab086191992210f4788c.zip |
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
Diffstat (limited to 'railties/lib/console_profile.rb')
-rw-r--r-- | railties/lib/console_profile.rb | 14 |
1 files changed, 14 insertions, 0 deletions
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 |