Sha256: 83be209776987c3a3f4ee503e769f6957e28a2b990bbd9a44ec1f711c29e1d08

Contents?: true

Size: 1.15 KB

Versions: 139

Compression:

Stored size: 1.15 KB

Contents

require 'optparse'
require 'rails/test_help'
require 'rails/performance_test_help'
require 'active_support/testing/performance'

def options
  options = {}
  defaults = ActiveSupport::Testing::Performance::DEFAULTS

  OptionParser.new do |opt|
    opt.banner = "Usage: rails benchmarker 'Ruby.code' 'Ruby.more_code' ... [OPTS]"
    opt.on('-r', '--runs N', Numeric, 'Number of runs.', "Default: #{defaults[:runs]}") { |r| options[:runs] = r }
    opt.on('-o', '--output PATH', String, 'Directory to use when writing the results.', "Default: #{defaults[:output]}") { |o| options[:output] = o }
    opt.on('-m', '--metrics a,b,c', Array, 'Metrics to use.', "Default: #{defaults[:metrics].join(",")}") { |m| options[:metrics] = m.map(&:to_sym) }
    opt.on('-f', '--formats x,y,z', Array, 'Formats to output to.', "Default: #{defaults[:formats].join(",")}") { |m| options[:formats] = m.map(&:to_sym) }
    opt.parse!(ARGV)
  end

  options
end

class ProfilerTest < ActionDispatch::PerformanceTest #:nodoc:
  self.profile_options = options

  ARGV.each do |expression|
    eval <<-RUBY
      def test_#{expression.parameterize('_')}
        #{expression}
      end
    RUBY
  end
end

Version data entries

139 entries across 100 versions & 19 rubygems

Version Path
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands/profiler.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/railties-3.2.12/lib/rails/commands/profiler.rb
swipe-rails-0.0.5 vendor/bundle/gems/railties-3.2.13/lib/rails/commands/profiler.rb
active_mailer-0.0.9 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands/profiler.rb
active_mailer-0.0.8 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands/profiler.rb
active_mailer-0.0.7 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands/profiler.rb
active_mailer-0.0.6 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands/profiler.rb
font-awesome-rails-3.1.1.2 vendor/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/profiler.rb
font-awesome-rails-3.1.1.2 vendor/ruby/2.0.0/gems/railties-3.2.12/lib/rails/commands/profiler.rb
font-awesome-rails-3.1.1.2 vendor/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands/profiler.rb
font-awesome-rails-3.1.1.1 vendor/ruby/2.0.0/gems/railties-3.2.12/lib/rails/commands/profiler.rb
font-awesome-rails-3.1.1.1 vendor/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands/profiler.rb
font-awesome-rails-3.1.1.1 vendor/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/profiler.rb
challah-1.0.0.beta3 vendor/bundle/gems/railties-3.2.13/lib/rails/commands/profiler.rb
fc-webicons-0.0.4 vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/profiler.rb
challah-1.0.0.beta2 vendor/bundle/gems/railties-3.2.13/lib/rails/commands/profiler.rb
challah-1.0.0.beta vendor/bundle/gems/railties-3.2.13/lib/rails/commands/profiler.rb
challah-1.0.0.beta vendor/bundle/gems/railties-3.2.11/lib/rails/commands/profiler.rb
fc-webicons-0.0.3 vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/profiler.rb
fc-webicons-0.0.2 vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/profiler.rb