Methods
E
N
O
R
W
Constants
HEADER = 'measurement,created_at,app,rails,ruby,platform'
 
Class Public methods
new(*args)
# File activesupport/lib/active_support/testing/performance.rb, line 180
def initialize(*args)
  super
  @supported = @metric.respond_to?('measure')
end
Instance Public methods
environment()
# File activesupport/lib/active_support/testing/performance.rb, line 200
def environment
  unless defined? @env
    app = "#{$1}.#{$2}" if File.directory?('.git') && %xgit branch -v` =~ %r^\* (\S+)\s+(\S+)/

    rails = Rails::VERSION::STRING
    if File.directory?('vendor/rails/.git')
      Dir.chdir('vendor/rails') do
        rails += ".#{$1}.#{$2}" if %xgit branch -v` =~ %r^\* (\S+)\s+(\S+)/
      end
    end

    ruby = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
    ruby += "-#{RUBY_VERSION}.#{RUBY_PATCHLEVEL}"

    @env = [app, rails, ruby, RUBY_PLATFORM] * ','
  end

  @env
end
record()
# File activesupport/lib/active_support/testing/performance.rb, line 192
def record
  avg = @metric.total / full_profile_options[:runs].to_i
  now = Time.now.utc.xmlschema
  with_output_file do |file|
    file.puts "#{avg},#{now},#{environment}"
  end
end
run()
# File activesupport/lib/active_support/testing/performance.rb, line 185
def run
  return unless @supported

  full_profile_options[:runs].to_i.times { run_test(@metric, :benchmark) }
  @total = @metric.total
end
Instance Protected methods
output_filename()
# File activesupport/lib/active_support/testing/performance.rb, line 236
def output_filename
  "#{super}.csv"
end
with_output_file()
# File activesupport/lib/active_support/testing/performance.rb, line 223
def with_output_file
  fname = output_filename

  if new = !File.exist?(fname)
    FileUtils.mkdir_p(File.dirname(fname))
  end

  File.open(fname, 'ab') do |file|
    file.puts(HEADER) if new
    yield file
  end
end