From 84fe2b8b4266f5ef4e3e5f2880a18b8e44a070f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Silva?= Date: Sat, 26 Mar 2011 19:12:04 +0000 Subject: added basic structure for jruby --- .../lib/active_support/testing/performance.rb | 9 ++- .../active_support/testing/performance/jruby.rb | 70 ++++++++++++++++++++++ .../active_support/testing/performance/rubinius.rb | 7 +-- 3 files changed, 78 insertions(+), 8 deletions(-) create mode 100644 activesupport/lib/active_support/testing/performance/jruby.rb (limited to 'activesupport/lib/active_support/testing') 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) -- cgit v1.2.3