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

Inherits:
Object
  • Object
show all
Defined in:
activesupport/lib/active_support/testing/performance.rb

Direct Known Subclasses

GcRuns, GcTime, Memory, Objects, Time

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Base) initialize



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

def initialize
  @total = 0
end

Instance Attribute Details

- (Object) total (readonly)

Returns the value of attribute total



228
229
230
# File 'activesupport/lib/active_support/testing/performance.rb', line 228

def total
  @total
end

Instance Method Details

- (Object) benchmark



246
247
248
249
250
251
252
# File 'activesupport/lib/active_support/testing/performance.rb', line 246

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

- (Object) measure



242
243
244
# File 'activesupport/lib/active_support/testing/performance.rb', line 242

def measure
  0
end

- (Object) measure_mode



238
239
240
# File 'activesupport/lib/active_support/testing/performance.rb', line 238

def measure_mode
  self.class::Mode
end

- (Object) name



234
235
236
# File 'activesupport/lib/active_support/testing/performance.rb', line 234

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

- (Object) profile



254
255
256
257
258
259
# File 'activesupport/lib/active_support/testing/performance.rb', line 254

def profile
  RubyProf.resume
  yield
ensure
  RubyProf.pause
end