diff options
3 files changed, 20 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/testing/performance/jruby.rb b/activesupport/lib/active_support/testing/performance/jruby.rb index 5985e942f1..51c716ef4a 100644 --- a/activesupport/lib/active_support/testing/performance/jruby.rb +++ b/activesupport/lib/active_support/testing/performance/jruby.rb @@ -1,9 +1,21 @@ +require 'jruby/profiler' +require 'java' +import java.lang.management.ManagementFactory + module ActiveSupport module Testing - module Performance + module Performance + if ARGV.include?('--benchmark') + DEFAULTS.merge!({:metrics => [:wall_time, :user_time, :memory, :gc_runs, :gc_time, :ola]}) + else + DEFAULTS.merge!( + { :metrics => [:wall_time], + :formats => [:flat, :graph] }) + end + protected def run_gc - GC.start + ManagementFactory.memory_mx_bean.gc end class Performer; end diff --git a/activesupport/lib/active_support/testing/performance/rubinius.rb b/activesupport/lib/active_support/testing/performance/rubinius.rb index 67d21e2a43..bdbb530b37 100644 --- a/activesupport/lib/active_support/testing/performance/rubinius.rb +++ b/activesupport/lib/active_support/testing/performance/rubinius.rb @@ -3,7 +3,9 @@ require 'rubinius/agent' module ActiveSupport module Testing module Performance - if !ARGV.include?('--benchmark') + if ARGV.include?('--benchmark') + DEFAULTS.merge!({:metrics => [:wall_time, :memory, :objects, :gc_runs, :gc_time]}) + else DEFAULTS.merge!( { :metrics => [:wall_time], :formats => [:flat, :graph] }) diff --git a/activesupport/lib/active_support/testing/performance/ruby.rb b/activesupport/lib/active_support/testing/performance/ruby.rb index dc77f22ba2..b36b201531 100644 --- a/activesupport/lib/active_support/testing/performance/ruby.rb +++ b/activesupport/lib/active_support/testing/performance/ruby.rb @@ -8,7 +8,9 @@ end module ActiveSupport module Testing module Performance - if !ARGV.include?('--benchmark') + if ARGV.include?('--benchmark') + DEFAULTS.merge!({:metrics => [:wall_time, :memory, :objects, :gc_runs, :gc_time]}) + else DEFAULTS.merge!( { :min_percent => 0.01, :metrics => [:process_time, :memory, :objects], |