Methods
- E
- N
- O
- R
- W
Constants
HEADER | = | 'measurement,created_at,app,rails,ruby,platform' |
Class Public methods
Instance Public methods
# File activesupport/lib/active_support/testing/performance.rb, line 200 200: def environment 201: unless defined? @env 202: app = "#{$1}.#{$2}" if File.directory?('.git') && `git branch -v` =~ /^\* (\S+)\s+(\S+)/ 203: 204: rails = Rails::VERSION::STRING 205: if File.directory?('vendor/rails/.git') 206: Dir.chdir('vendor/rails') do 207: rails += ".#{$1}.#{$2}" if `git branch -v` =~ /^\* (\S+)\s+(\S+)/ 208: end 209: end 210: 211: ruby = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby' 212: ruby += "-#{RUBY_VERSION}.#{RUBY_PATCHLEVEL}" 213: 214: @env = [app, rails, ruby, RUBY_PLATFORM] * ',' 215: end 216: 217: @env 218: end
# File activesupport/lib/active_support/testing/performance.rb, line 192 192: def record 193: avg = @metric.total / full_profile_options[:runs].to_i 194: now = Time.now.utc.xmlschema 195: with_output_file do |file| 196: file.puts "#{avg},#{now},#{environment}" 197: end 198: end
Instance Protected methods
# File activesupport/lib/active_support/testing/performance.rb, line 223 223: def with_output_file 224: fname = output_filename 225: 226: if new = !File.exist?(fname) 227: FileUtils.mkdir_p(File.dirname(fname)) 228: end 229: 230: File.open(fname, 'ab') do |file| 231: file.puts(HEADER) if new 232: yield file 233: end 234: end