Class: TimeMethod::Measurement
- Inherits:
-
Object
- Object
- TimeMethod::Measurement
- Defined in:
- lib/time_method/measurement.rb
Instance Attribute Summary collapse
-
#klass_name ⇒ Object
Returns the value of attribute klass_name.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#method_name ⇒ Object
Returns the value of attribute method_name.
-
#segment ⇒ Object
Returns the value of attribute segment.
-
#t0 ⇒ Object
Returns the value of attribute t0.
-
#t1 ⇒ Object
Returns the value of attribute t1.
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize(klass_name:, method_name:, t0:, t1:) ⇒ Measurement
constructor
A new instance of Measurement.
- #output_stack ⇒ Object
- #runtime ⇒ Object
- #runtime_ms ⇒ Object
- #runtime_seconds ⇒ Object
- #store_measurement ⇒ Object
Constructor Details
#initialize(klass_name:, method_name:, t0:, t1:) ⇒ Measurement
Returns a new instance of Measurement.
4 5 6 7 8 9 10 11 12 |
# File 'lib/time_method/measurement.rb', line 4 def initialize(klass_name:, method_name:, t0:, t1:) @klass_name = klass_name @method_name = method_name @t0 = t0 @t1 = t1 # @time = runtime_ms @time = runtime_seconds store_measurement end |
Instance Attribute Details
#klass_name ⇒ Object
Returns the value of attribute klass_name.
3 4 5 |
# File 'lib/time_method/measurement.rb', line 3 def klass_name @klass_name end |
#metadata ⇒ Object
Returns the value of attribute metadata.
3 4 5 |
# File 'lib/time_method/measurement.rb', line 3 def @metadata end |
#method_name ⇒ Object
Returns the value of attribute method_name.
3 4 5 |
# File 'lib/time_method/measurement.rb', line 3 def method_name @method_name end |
#segment ⇒ Object
Returns the value of attribute segment.
3 4 5 |
# File 'lib/time_method/measurement.rb', line 3 def segment @segment end |
#t0 ⇒ Object
Returns the value of attribute t0.
3 4 5 |
# File 'lib/time_method/measurement.rb', line 3 def t0 @t0 end |
#t1 ⇒ Object
Returns the value of attribute t1.
3 4 5 |
# File 'lib/time_method/measurement.rb', line 3 def t1 @t1 end |
#time ⇒ Object
Returns the value of attribute time.
3 4 5 |
# File 'lib/time_method/measurement.rb', line 3 def time @time end |
Instance Method Details
#output_stack ⇒ Object
18 19 20 |
# File 'lib/time_method/measurement.rb', line 18 def output_stack StoreMeasurement.instance.output_stack end |
#runtime ⇒ Object
22 23 24 |
# File 'lib/time_method/measurement.rb', line 22 def runtime @runtime_in_milliseconds ||= ((@t1 - @t0) * 1000).round(2) end |
#runtime_ms ⇒ Object
26 27 28 |
# File 'lib/time_method/measurement.rb', line 26 def runtime_ms @runtime_in_milliseconds ||= ((@t1 - @t0) * 1000).round(2) end |
#runtime_seconds ⇒ Object
30 31 32 |
# File 'lib/time_method/measurement.rb', line 30 def runtime_seconds @runtime_in_seconds ||= (@t1 - @t0).round(2) end |
#store_measurement ⇒ Object
14 15 16 |
# File 'lib/time_method/measurement.rb', line 14 def store_measurement StoreMeasurement.instance.store(klass_name:@klass_name,method_name:@method_name,time:@time) end |