module ActiveSupport::Testing::Performance

Constants

DEFAULTS

each implementation should define metrics and freeze the defaults

Public Instance Methods

full_profile_options() click to toggle source
# File lib/active_support/testing/performance.rb, line 36
def full_profile_options
  DEFAULTS.merge(profile_options)
end
full_test_name() click to toggle source
# File lib/active_support/testing/performance.rb, line 40
def full_test_name
  "#{self.class.name}##{method_name}"
end

Protected Instance Methods

run_gc() click to toggle source

overridden by each implementation

# File lib/active_support/testing/performance.rb, line 124
def run_gc; end
run_profile(metric) click to toggle source
# File lib/active_support/testing/performance.rb, line 136
def run_profile(metric)
  klass = full_profile_options[:benchmark] ? Benchmarker : Profiler
  performer = klass.new(self, metric)

  performer.run
  puts performer.report
  performer.record
end
run_warmup() click to toggle source
# File lib/active_support/testing/performance.rb, line 126
def run_warmup
  run_gc

  time = Metrics::Time.new
  run_test(time, :benchmark)
  puts "%s (%s warmup)" % [full_test_name, time.format(time.total)]

  run_gc
end