Class Index [+]

Quicksearch

ActiveSupport::Testing::Performance::Benchmarker

Constants

HEADER

Public Instance Methods

environment() click to toggle source
     # File lib/active_support/testing/performance.rb, line 126
126:           def environment
127:             unless defined? @env
128:               app = "#{$1}.#{$2}" if File.directory?('.git') && `git branch -v` =~ /^\* (\S+)\s+(\S+)/
129: 
130:               rails = Rails::VERSION::STRING
131:               if File.directory?('vendor/rails/.git')
132:                 Dir.chdir('vendor/rails') do
133:                   rails += ".#{$1}.#{$2}" if `git branch -v` =~ /^\* (\S+)\s+(\S+)/
134:                 end
135:               end
136: 
137:               ruby = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
138:               ruby += "-#{RUBY_VERSION}.#{RUBY_PATCHLEVEL}"
139: 
140:               @env = [app, rails, ruby, RUBY_PLATFORM] * ','
141:             end
142: 
143:             @env
144:           end
record() click to toggle source
     # File lib/active_support/testing/performance.rb, line 118
118:           def record
119:             avg = @metric.total / profile_options[:runs].to_i
120:             now = Time.now.utc.xmlschema
121:             with_output_file do |file|
122:               file.puts "#{avg},#{now},#{environment}"
123:             end
124:           end
run() click to toggle source
     # File lib/active_support/testing/performance.rb, line 113
113:           def run
114:             profile_options[:runs].to_i.times { run_test(@metric, :benchmark) }
115:             @total = @metric.total
116:           end

Protected Instance Methods

output_filename() click to toggle source
     # File lib/active_support/testing/performance.rb, line 162
162:             def output_filename
163:               "#{super}.csv"
164:             end
with_output_file() click to toggle source
     # File lib/active_support/testing/performance.rb, line 149
149:             def with_output_file
150:               fname = output_filename
151: 
152:               if new = !File.exist?(fname)
153:                 FileUtils.mkdir_p(File.dirname(fname))
154:               end
155: 
156:               File.open(fname, 'ab') do |file|
157:                 file.puts(HEADER) if new
158:                 yield file
159:               end
160:             end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.