diff options
Diffstat (limited to 'activesupport/lib/active_support/testing/performance')
3 files changed, 10 insertions, 78 deletions
diff --git a/activesupport/lib/active_support/testing/performance/ruby.rb b/activesupport/lib/active_support/testing/performance/ruby.rb index 7d6d047ef6..26731c6bd7 100644 --- a/activesupport/lib/active_support/testing/performance/ruby.rb +++ b/activesupport/lib/active_support/testing/performance/ruby.rb @@ -144,8 +144,6 @@ end if RUBY_VERSION.between?('1.9.2', '2.0') require 'active_support/testing/performance/ruby/yarv' -elsif RUBY_VERSION.between?('1.8.6', '1.9') - require 'active_support/testing/performance/ruby/mri' else $stderr.puts 'Update your ruby interpreter to be able to run benchmarks.' exit diff --git a/activesupport/lib/active_support/testing/performance/ruby/mri.rb b/activesupport/lib/active_support/testing/performance/ruby/mri.rb deleted file mode 100644 index 142279dd6e..0000000000 --- a/activesupport/lib/active_support/testing/performance/ruby/mri.rb +++ /dev/null @@ -1,57 +0,0 @@ -module ActiveSupport - module Testing - module Performance - module Metrics - class Base - protected - # Ruby 1.8 + ruby-prof wrapper (enable/disable stats for Benchmarker) - if GC.respond_to?(:enable_stats) - def with_gc_stats - GC.enable_stats - GC.start - yield - ensure - GC.disable_stats - end - end - end - - class Memory < DigitalInformationUnit - # Ruby 1.8 + ruby-prof wrapper - if RubyProf.respond_to?(:measure_memory) - def measure - RubyProf.measure_memory - end - end - end - - class Objects < Amount - # Ruby 1.8 + ruby-prof wrapper - if RubyProf.respond_to?(:measure_allocations) - def measure - RubyProf.measure_allocations - end - end - end - - class GcRuns < Amount - # Ruby 1.8 + ruby-prof wrapper - if RubyProf.respond_to?(:measure_gc_runs) - def measure - RubyProf.measure_gc_runs - end - end - end - - class GcTime < Time - # Ruby 1.8 + ruby-prof wrapper - if RubyProf.respond_to?(:measure_gc_time) - def measure - RubyProf.measure_gc_time / 1000.0 / 1000.0 - end - end - end - end - end - end -end diff --git a/activesupport/lib/active_support/testing/performance/ruby/yarv.rb b/activesupport/lib/active_support/testing/performance/ruby/yarv.rb index 7873262331..c34d31bf10 100644 --- a/activesupport/lib/active_support/testing/performance/ruby/yarv.rb +++ b/activesupport/lib/active_support/testing/performance/ruby/yarv.rb @@ -4,15 +4,12 @@ module ActiveSupport module Metrics class Base protected - # Ruby 1.9 with GC::Profiler - if defined?(GC::Profiler) - def with_gc_stats - GC::Profiler.enable - GC.start - yield - ensure - GC::Profiler.disable - end + def with_gc_stats + GC::Profiler.enable + GC.start + yield + ensure + GC::Profiler.disable end end @@ -35,20 +32,14 @@ module ActiveSupport end class GcRuns < Amount - # Ruby 1.9 - if GC.respond_to?(:count) - def measure - GC.count - end + def measure + GC.count end end class GcTime < Time - # Ruby 1.9 with GC::Profiler - if defined?(GC::Profiler) && GC::Profiler.respond_to?(:total_time) - def measure - GC::Profiler.total_time - end + def measure + GC::Profiler.total_time end end end |