Class: NoSE::Measurements::Measurement
- Inherits:
-
Object
- Object
- NoSE::Measurements::Measurement
- Extended by:
- Forwardable
- Includes:
- DescriptiveStatistics, Enumerable
- Defined in:
- lib/nose_cli/measurements.rb
Overview
A measurement of a single statement execution time
Instance Attribute Summary collapse
-
#estimate ⇒ Object
Returns the value of attribute estimate.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#plan ⇒ Object
readonly
Returns the value of attribute plan.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Instance Method Summary collapse
-
#initialize(plan, name = nil, estimate = nil, weight: 1.0) ⇒ Measurement
constructor
A new instance of Measurement.
-
#weighted_mean ⇒ Fixnum
The mean weighted by this measurement weight.
Constructor Details
#initialize(plan, name = nil, estimate = nil, weight: 1.0) ⇒ Measurement
Returns a new instance of Measurement.
21 22 23 24 25 26 27 |
# File 'lib/nose_cli/measurements.rb', line 21 def initialize(plan, name = nil, estimate = nil, weight: 1.0) @plan = plan @name = name || (plan && plan.name) @estimate = estimate @weight = weight @values = [] end |
Instance Attribute Details
#estimate ⇒ Object
Returns the value of attribute estimate.
11 12 13 |
# File 'lib/nose_cli/measurements.rb', line 11 def estimate @estimate end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/nose_cli/measurements.rb', line 12 def name @name end |
#plan ⇒ Object (readonly)
Returns the value of attribute plan.
12 13 14 |
# File 'lib/nose_cli/measurements.rb', line 12 def plan @plan end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
12 13 14 |
# File 'lib/nose_cli/measurements.rb', line 12 def weight @weight end |
Instance Method Details
#weighted_mean ⇒ Fixnum
The mean weighted by this measurement weight
31 32 33 |
# File 'lib/nose_cli/measurements.rb', line 31 def weighted_mean @weight * mean end |