Class: ActiveSupport::Testing::Performance::Metrics::Time

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

Direct Known Subclasses

CpuTime, GcTime, ProcessTime, UserTime, WallTime

Constant Summary

Constants included from ActionView::Helpers::NumberHelper

ActionView::Helpers::NumberHelper::DECIMAL_UNITS, ActionView::Helpers::NumberHelper::DEFAULT_CURRENCY_VALUES, ActionView::Helpers::NumberHelper::STORAGE_UNITS

Instance Attribute Summary

Attributes inherited from Base

#loopback, #total

Instance Method Summary collapse

Methods inherited from Base

#benchmark, #initialize, #measure_mode, #name, #profile

Methods included from ActionView::Helpers::NumberHelper

#number_to_currency, #number_to_human, #number_to_human_size, #number_to_percentage, #number_to_phone, #number_with_delimiter, #number_with_precision

Constructor Details

This class inherits a constructor from ActiveSupport::Testing::Performance::Metrics::Base

Instance Method Details

#format(measurement) ⇒ Object



282
283
284
285
286
287
288
# File 'activesupport/lib/active_support/testing/performance.rb', line 282

def format(measurement)
  if measurement < 1
    '%d ms' % (measurement * 1000)
  else
    '%.2f sec' % measurement
  end
end

#measureObject



278
279
280
# File 'activesupport/lib/active_support/testing/performance.rb', line 278

def measure
  ::Time.now.to_f
end