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

Inherits:
Object
  • Object
show all
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

Amount, DigitalInformationUnit, Time

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



232
233
234
# File 'lib/rails/perftest/active_support/testing/performance.rb', line 232

def initialize
  @total = 0
end

Instance Attribute Details

#loopbackObject (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

#totalObject (readonly)

Returns the value of attribute total.



230
231
232
# File 'lib/rails/perftest/active_support/testing/performance.rb', line 230

def total
  @total
end

Instance Method Details

#benchmarkObject



240
241
242
243
244
245
246
# File 'lib/rails/perftest/active_support/testing/performance.rb', line 240

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

#measure_modeObject



80
81
82
# File 'lib/rails/perftest/active_support/testing/performance/ruby.rb', line 80

def measure_mode
  self.class::Mode
end

#nameObject



236
237
238
# File 'lib/rails/perftest/active_support/testing/performance.rb', line 236

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

#profileObject

overridden by each implementation.



249
# File 'lib/rails/perftest/active_support/testing/performance.rb', line 249

def profile; end