Skip to content

Commit

Permalink
added basic structure for Rubinius
Browse files Browse the repository at this point in the history
  • Loading branch information
goncalossilva committed Mar 25, 2011
1 parent 2fa426c commit 995d543
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 6 deletions.
7 changes: 4 additions & 3 deletions activesupport/lib/active_support/testing/performance.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -271,10 +271,11 @@ def measure; end
end end
end end


RUBY_ENGINE = "ruby" unless defined?(RUBY_ENGINE) RUBY_ENGINE = 'ruby' unless defined?(RUBY_ENGINE) # mri 1.8
case RUBY_ENGINE 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 else
$stderr.puts "Your ruby interpreter is not supported for benchmarking." $stderr.puts 'Your ruby interpreter is not supported for benchmarking.'
exit exit
end end
61 changes: 61 additions & 0 deletions activesupport/lib/active_support/testing/performance/rubinius.rb
Original file line number Original file line Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions activesupport/lib/active_support/testing/performance/ruby.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ def measure; 0; end
end end
end end


if RUBY_VERSION >= "1.9.2" if RUBY_VERSION >= '1.9.2'
require 'active_support/testing/performance/ruby/yarv' 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' require 'active_support/testing/performance/ruby/mri'
else 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 exit
end end

0 comments on commit 995d543

Please sign in to comment.