diff options
author | Gonçalo Silva <goncalossilva@gmail.com> | 2011-03-25 17:18:06 +0000 |
---|---|---|
committer | Gonçalo Silva <goncalossilva@gmail.com> | 2011-03-25 17:18:06 +0000 |
commit | 995d543b6458f84b05bd75464c7c270f1dfb14d2 (patch) | |
tree | de983b21fcd8c3d475f0bc26a4b25e06ade0cdac /activesupport/lib | |
parent | 2fa426c9444dc6dd1b701592cf4d636739556b9e (diff) | |
download | rails-995d543b6458f84b05bd75464c7c270f1dfb14d2.tar.gz rails-995d543b6458f84b05bd75464c7c270f1dfb14d2.tar.bz2 rails-995d543b6458f84b05bd75464c7c270f1dfb14d2.zip |
added basic structure for Rubinius
Diffstat (limited to 'activesupport/lib')
3 files changed, 68 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/testing/performance.rb b/activesupport/lib/active_support/testing/performance.rb index a7faf6267a..ae78fafe78 100644 --- a/activesupport/lib/active_support/testing/performance.rb +++ b/activesupport/lib/active_support/testing/performance.rb @@ -271,10 +271,11 @@ module ActiveSupport end end -RUBY_ENGINE = "ruby" unless defined?(RUBY_ENGINE) +RUBY_ENGINE = 'ruby' unless defined?(RUBY_ENGINE) # mri 1.8 case RUBY_ENGINE - when "ruby" then require 'active_support/testing/performance/ruby' + when 'ruby' then require 'active_support/testing/performance/ruby' + when 'rubinius' then require 'active_support/testing/performance/rubinius' else - $stderr.puts "Your ruby interpreter is not supported for benchmarking." + $stderr.puts 'Your ruby interpreter is not supported for benchmarking.' exit end diff --git a/activesupport/lib/active_support/testing/performance/rubinius.rb b/activesupport/lib/active_support/testing/performance/rubinius.rb new file mode 100644 index 0000000000..c6725b988a --- /dev/null +++ b/activesupport/lib/active_support/testing/performance/rubinius.rb @@ -0,0 +1,61 @@ +module ActiveSupport + module Testing + module Performance + protected + def run_gc + end + + module Metrics + class Base + def profile + yield + end + + protected + def with_gc_stats + yield + end + end + + class Time < Base; end + + class ProcessTime < Time + def measure; 0; end + end + + class WallTime < Time + def measure; 0; end + end + + class CpuTime < Time + def measure; 0; end + end + + class Memory < Base + def measure; 0; end + end + + class Objects < Amount + def measure; 0; end + end + + class GcRuns < Amount + def measure; 0; end + end + + class GcTime < Time + def measure; 0; end + end + end + end + end +end + +if RUBY_VERSION >= '1.9.2' + require 'active_support/testing/performance/ruby/yarv' +elsif RUBY_VERSION >= '1.8.6' + require 'active_support/testing/performance/ruby/mri' +else + $stderr.puts 'Update your ruby interpreter to be able to run benchmarks.' + exit +end diff --git a/activesupport/lib/active_support/testing/performance/ruby.rb b/activesupport/lib/active_support/testing/performance/ruby.rb index 86287b2d45..f786b85925 100644 --- a/activesupport/lib/active_support/testing/performance/ruby.rb +++ b/activesupport/lib/active_support/testing/performance/ruby.rb @@ -157,11 +157,11 @@ module ActiveSupport end end -if RUBY_VERSION >= "1.9.2" +if RUBY_VERSION >= '1.9.2' require 'active_support/testing/performance/ruby/yarv' -elsif RUBY_VERSION >= "1.8.6" +elsif RUBY_VERSION >= '1.8.6' require 'active_support/testing/performance/ruby/mri' else - $stderr.puts "Update your ruby interpreter to be able to run benchmarks." + $stderr.puts 'Update your ruby interpreter to be able to run benchmarks.' exit end |