Class: ActiveSupport::Testing::Performance::Metrics::Base
- Inherits:
-
Object
- Object
- ActiveSupport::Testing::Performance::Metrics::Base
- Includes:
- NumberHelper
- Defined in:
- lib/rails/perftest/active_support/testing/performance.rb,
lib/rails/perftest/active_support/testing/performance/ruby.rb,
lib/rails/perftest/active_support/testing/performance/jruby.rb,
lib/rails/perftest/active_support/testing/performance/rubinius.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#loopback ⇒ Object
readonly
Returns the value of attribute loopback.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #benchmark ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #measure_mode ⇒ Object
- #name ⇒ Object
-
#profile ⇒ Object
overridden by each implementation.
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
234 235 236 |
# File 'lib/rails/perftest/active_support/testing/performance.rb', line 234 def initialize @total = 0 end |
Instance Attribute Details
#loopback ⇒ Object (readonly)
Returns the value of attribute loopback.
67 68 69 |
# File 'lib/rails/perftest/active_support/testing/performance/rubinius.rb', line 67 def loopback @loopback end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
232 233 234 |
# File 'lib/rails/perftest/active_support/testing/performance.rb', line 232 def total @total end |
Instance Method Details
#benchmark ⇒ Object
242 243 244 245 246 247 248 |
# File 'lib/rails/perftest/active_support/testing/performance.rb', line 242 def benchmark with_gc_stats do before = measure yield @total += (measure - before) end end |
#measure_mode ⇒ Object
80 81 82 |
# File 'lib/rails/perftest/active_support/testing/performance/ruby.rb', line 80 def measure_mode self.class::Mode end |
#name ⇒ Object
238 239 240 |
# File 'lib/rails/perftest/active_support/testing/performance.rb', line 238 def name @name ||= self.class.name.demodulize.underscore end |
#profile ⇒ Object
overridden by each implementation.
251 |
# File 'lib/rails/perftest/active_support/testing/performance.rb', line 251 def profile; end |