aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorGonçalo Silva <goncalossilva@gmail.com>2011-03-26 19:12:04 +0000
committerGonçalo Silva <goncalossilva@gmail.com>2011-03-26 19:34:59 +0000
commit84fe2b8b4266f5ef4e3e5f2880a18b8e44a070f0 (patch)
tree7ab4da8ac3ba0ccf751bd2d8f21ee787ade47f69 /activesupport/lib
parent3872cc4a739db7e0fb5b4a910be371c048667ca7 (diff)
downloadrails-84fe2b8b4266f5ef4e3e5f2880a18b8e44a070f0.tar.gz
rails-84fe2b8b4266f5ef4e3e5f2880a18b8e44a070f0.tar.bz2
rails-84fe2b8b4266f5ef4e3e5f2880a18b8e44a070f0.zip
added basic structure for jruby
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/testing/performance.rb9
-rw-r--r--activesupport/lib/active_support/testing/performance/jruby.rb70
-rw-r--r--activesupport/lib/active_support/testing/performance/rubinius.rb7
3 files changed, 78 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/testing/performance.rb b/activesupport/lib/active_support/testing/performance.rb
index bba05d0a51..0472f44a20 100644
--- a/activesupport/lib/active_support/testing/performance.rb
+++ b/activesupport/lib/active_support/testing/performance.rb
@@ -111,6 +111,10 @@ module ActiveSupport
# overridden by each implementation
class Profiler < Performer
+ def initialize(*args)
+ super
+ end
+
def run; end
def report; end
def record; end
@@ -272,8 +276,9 @@ end
RUBY_ENGINE = 'ruby' unless defined?(RUBY_ENGINE) # mri 1.8
case RUBY_ENGINE
- when 'ruby' then require 'active_support/testing/performance/ruby'
- when 'rbx' then require 'active_support/testing/performance/rubinius'
+ when 'ruby' then require 'active_support/testing/performance/ruby'
+ when 'rbx' then require 'active_support/testing/performance/rubinius'
+ when 'jruby' then require 'active_support/testing/performance/jruby'
else
$stderr.puts 'Your ruby interpreter is not supported for benchmarking.'
exit
diff --git a/activesupport/lib/active_support/testing/performance/jruby.rb b/activesupport/lib/active_support/testing/performance/jruby.rb
new file mode 100644
index 0000000000..5985e942f1
--- /dev/null
+++ b/activesupport/lib/active_support/testing/performance/jruby.rb
@@ -0,0 +1,70 @@
+module ActiveSupport
+ module Testing
+ module Performance
+ protected
+ def run_gc
+ GC.start
+ end
+
+ class Performer; end
+
+ class Profiler < Performer
+ def run
+ end
+
+ def report
+ end
+
+ def record
+ end
+
+ protected
+ def output_filename(printer_class)
+ end
+ end
+
+ module Metrics
+ class Base
+ def profile
+ end
+
+ protected
+ def with_gc_stats
+ end
+
+ class Time < Base; end
+
+ class ProcessTime < Time
+ def measure; 0; end
+ end
+
+ class WallTime < Time
+ def measure
+ super
+ 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
+end
diff --git a/activesupport/lib/active_support/testing/performance/rubinius.rb b/activesupport/lib/active_support/testing/performance/rubinius.rb
index 8f1047381b..c8813a22df 100644
--- a/activesupport/lib/active_support/testing/performance/rubinius.rb
+++ b/activesupport/lib/active_support/testing/performance/rubinius.rb
@@ -16,11 +16,7 @@ module ActiveSupport
class Performer; end
- class Profiler < Performer
- def initialize(*args)
- super
- end
-
+ class Profiler < Performer
def run
@profiler = Rubinius::Profiler::Instrumenter.new
@@ -72,7 +68,6 @@ module ActiveSupport
end
protected
- # overridden by each implementation
def with_gc_stats
@loopback = Rubinius::Agent.loopback
GC.run(true)