Class: ActiveSupport::Testing::Performance::Metrics::Base

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::NumberHelper
Defined in:
lib/active_support/testing/performance.rb,
lib/active_support/testing/performance/ruby.rb,
lib/active_support/testing/performance/jruby.rb,
lib/active_support/testing/performance/rubinius.rb,
lib/active_support/testing/performance/ruby/mri.rb,
lib/active_support/testing/performance/ruby/yarv.rb

Direct Known Subclasses

Amount, DigitalInformationUnit, Time

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



253
254
255
# File 'lib/active_support/testing/performance.rb', line 253

def initialize
  @total = 0
end

Instance Attribute Details

#loopbackObject (readonly)

Returns the value of attribute loopback.



67
68
69
# File 'lib/active_support/testing/performance/rubinius.rb', line 67

def loopback
  @loopback
end

#totalObject (readonly)

Returns the value of attribute total.



251
252
253
# File 'lib/active_support/testing/performance.rb', line 251

def total
  @total
end

Instance Method Details

#benchmarkObject



261
262
263
264
265
266
267
# File 'lib/active_support/testing/performance.rb', line 261

def benchmark            
  with_gc_stats do
    before = measure
    yield
    @total += (measure - before)
  end
end

#measure_modeObject



77
78
79
# File 'lib/active_support/testing/performance/ruby.rb', line 77

def measure_mode
  self.class::Mode
end

#nameObject



257
258
259
# File 'lib/active_support/testing/performance.rb', line 257

def name
  @name ||= self.class.name.demodulize.underscore
end

#profileObject

overridden by each implementation



270
# File 'lib/active_support/testing/performance.rb', line 270

def profile; end