Class: ActiveSupport::Testing::Performance::Metrics::Base
- Inherits:
-
Object
- Object
- ActiveSupport::Testing::Performance::Metrics::Base
show all
- Defined in:
- lib/gems/activesupport-2.2.2/lib/active_support/testing/performance.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
230
231
232
|
# File 'lib/gems/activesupport-2.2.2/lib/active_support/testing/performance.rb', line 230
def initialize
@total = 0
end
|
Instance Attribute Details
Returns the value of attribute total.
228
229
230
|
# File 'lib/gems/activesupport-2.2.2/lib/active_support/testing/performance.rb', line 228
def total
@total
end
|
Instance Method Details
#benchmark ⇒ Object
246
247
248
249
250
251
252
|
# File 'lib/gems/activesupport-2.2.2/lib/active_support/testing/performance.rb', line 246
def benchmark
with_gc_stats do
before = measure
yield
@total += (measure - before)
end
end
|
242
243
244
|
# File 'lib/gems/activesupport-2.2.2/lib/active_support/testing/performance.rb', line 242
def measure
0
end
|
#measure_mode ⇒ Object
238
239
240
|
# File 'lib/gems/activesupport-2.2.2/lib/active_support/testing/performance.rb', line 238
def measure_mode
self.class::Mode
end
|
234
235
236
|
# File 'lib/gems/activesupport-2.2.2/lib/active_support/testing/performance.rb', line 234
def name
@name ||= self.class.name.demodulize.underscore
end
|
254
255
256
257
258
259
|
# File 'lib/gems/activesupport-2.2.2/lib/active_support/testing/performance.rb', line 254
def profile
RubyProf.resume
yield
ensure
RubyProf.pause
end
|