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
180:         def initialize(*args)
181:           super
182:           @supported = @metric.respond_to?('measure')
183:         end
Instance Public methods
environment()
     # 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
record()
     # 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
run()
     # File activesupport/lib/active_support/testing/performance.rb, line 185
185:         def run
186:           return unless @supported
187: 
188:           full_profile_options[:runs].to_i.times { run_test(@metric, :benchmark) }
189:           @total = @metric.total
190:         end
Instance Protected methods
output_filename()
     # File activesupport/lib/active_support/testing/performance.rb, line 236
236:           def output_filename
237:             "#{super}.csv"
238:           end
with_output_file()
     # 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