Class Index [+]

Quicksearch

ActiveSupport::Testing::Performance

Constants

DEFAULTS

Public Class Methods

included(base) click to toggle source
    # File lib/active_support/testing/performance.rb, line 27
27:         def self.included(base)
28:           base.superclass_delegating_accessor :profile_options
29:           base.profile_options = DEFAULTS
30:         end

Public Instance Methods

full_test_name() click to toggle source
    # File lib/active_support/testing/performance.rb, line 32
32:         def full_test_name
33:           "#{self.class.name}##{method_name}"
34:         end
run(result) click to toggle source
    # File lib/active_support/testing/performance.rb, line 36
36:         def run(result)
37:           return if method_name =~ /^default_test$/
38: 
39:           yield(self.class::STARTED, name)
40:           @_result = result
41: 
42:           run_warmup
43:           if profile_options && metrics = profile_options[:metrics]
44:             metrics.each do |metric_name|
45:               if klass = Metrics[metric_name.to_sym]
46:                 run_profile(klass.new)
47:                 result.add_run
48:               end
49:             end
50:           end
51: 
52:           yield(self.class::FINISHED, name)
53:         end
run_test(metric, mode) click to toggle source
    # File lib/active_support/testing/performance.rb, line 55
55:         def run_test(metric, mode)
56:           run_callbacks :setup
57:           setup
58:           metric.send(mode) { __send__ @method_name }
59:         rescue ::Test::Unit::AssertionFailedError => e
60:           add_failure(e.message, e.backtrace)
61:         rescue StandardError, ScriptError
62:           add_error($!)
63:         ensure
64:           begin
65:             teardown
66:             run_callbacks :teardown, :enumerator => :reverse_each
67:           rescue ::Test::Unit::AssertionFailedError => e
68:             add_failure(e.message, e.backtrace)
69:           rescue StandardError, ScriptError
70:             add_error($!)
71:           end
72:         end

Protected Instance Methods

run_profile(metric) click to toggle source
    # File lib/active_support/testing/performance.rb, line 85
85:           def run_profile(metric)
86:             klass = profile_options[:benchmark] ? Benchmarker : Profiler
87:             performer = klass.new(self, metric)
88: 
89:             performer.run
90:             puts performer.report
91:             performer.record
92:           end
run_warmup() click to toggle source
    # File lib/active_support/testing/performance.rb, line 75
75:           def run_warmup
76:             GC.start
77: 
78:             time = Metrics::Time.new
79:             run_test(time, :benchmark)
80:             puts "%s (%s warmup)" % [full_test_name, time.format(time.total)]
81: 
82:             GC.start
83:           end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.