Class: ProconBypassMan::Procon::PerformanceMeasurement::PerformanceSpan
- Inherits:
-
Object
- Object
- ProconBypassMan::Procon::PerformanceMeasurement::PerformanceSpan
- Defined in:
- lib/procon_bypass_man/procon/performance_measurement.rb
Instance Attribute Summary collapse
-
#external_input_time ⇒ Object
readonly
Returns the value of attribute external_input_time.
-
#gc_count ⇒ Object
Returns the value of attribute gc_count.
-
#gc_time ⇒ Object
Returns the value of attribute gc_time.
-
#interval_from_previous_succeed ⇒ Object
Returns the value of attribute interval_from_previous_succeed.
-
#read_error_count ⇒ Object
readonly
Returns the value of attribute read_error_count.
-
#read_time ⇒ Object
readonly
Returns the value of attribute read_time.
-
#succeed ⇒ Object
Returns the value of attribute succeed.
-
#time_taken ⇒ Object
Returns the value of attribute time_taken.
-
#write_error_count ⇒ Object
readonly
Returns the value of attribute write_error_count.
-
#write_time ⇒ Object
readonly
Returns the value of attribute write_time.
Instance Method Summary collapse
-
#initialize ⇒ PerformanceSpan
constructor
A new instance of PerformanceSpan.
- #record_external_input_time(&block) ⇒ void
- #record_read_error ⇒ Object
- #record_read_time(&block) ⇒ void
- #record_write_error ⇒ Object
- #record_write_time(&block) ⇒ Object
Constructor Details
#initialize ⇒ PerformanceSpan
Returns a new instance of PerformanceSpan.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/procon_bypass_man/procon/performance_measurement.rb', line 17 def initialize @write_error_count = 0 @read_error_count = 0 @time_taken = 0.0 @succeed = nil @interval_from_previous_succeed = nil @custom_metric = {} @write_time = 0.0 @read_time = 0.0 @gc_time = 0.0 end |
Instance Attribute Details
#external_input_time ⇒ Object (readonly)
Returns the value of attribute external_input_time.
15 16 17 |
# File 'lib/procon_bypass_man/procon/performance_measurement.rb', line 15 def external_input_time @external_input_time end |
#gc_count ⇒ Object
Returns the value of attribute gc_count.
14 15 16 |
# File 'lib/procon_bypass_man/procon/performance_measurement.rb', line 14 def gc_count @gc_count end |
#gc_time ⇒ Object
Returns the value of attribute gc_time.
14 15 16 |
# File 'lib/procon_bypass_man/procon/performance_measurement.rb', line 14 def gc_time @gc_time end |
#interval_from_previous_succeed ⇒ Object
Returns the value of attribute interval_from_previous_succeed.
14 15 16 |
# File 'lib/procon_bypass_man/procon/performance_measurement.rb', line 14 def interval_from_previous_succeed @interval_from_previous_succeed end |
#read_error_count ⇒ Object (readonly)
Returns the value of attribute read_error_count.
15 16 17 |
# File 'lib/procon_bypass_man/procon/performance_measurement.rb', line 15 def read_error_count @read_error_count end |
#read_time ⇒ Object (readonly)
Returns the value of attribute read_time.
15 16 17 |
# File 'lib/procon_bypass_man/procon/performance_measurement.rb', line 15 def read_time @read_time end |
#succeed ⇒ Object
Returns the value of attribute succeed.
14 15 16 |
# File 'lib/procon_bypass_man/procon/performance_measurement.rb', line 14 def succeed @succeed end |
#time_taken ⇒ Object
Returns the value of attribute time_taken.
14 15 16 |
# File 'lib/procon_bypass_man/procon/performance_measurement.rb', line 14 def time_taken @time_taken end |
#write_error_count ⇒ Object (readonly)
Returns the value of attribute write_error_count.
15 16 17 |
# File 'lib/procon_bypass_man/procon/performance_measurement.rb', line 15 def write_error_count @write_error_count end |
#write_time ⇒ Object (readonly)
Returns the value of attribute write_time.
15 16 17 |
# File 'lib/procon_bypass_man/procon/performance_measurement.rb', line 15 def write_time @write_time end |
Instance Method Details
#record_external_input_time(&block) ⇒ void
This method returns an undefined value.
49 50 51 |
# File 'lib/procon_bypass_man/procon/performance_measurement.rb', line 49 def record_external_input_time(&block) @external_input_time = Benchmark.realtime { block.call } end |
#record_read_error ⇒ Object
29 30 31 |
# File 'lib/procon_bypass_man/procon/performance_measurement.rb', line 29 def record_read_error @read_error_count += 1 end |
#record_read_time(&block) ⇒ void
This method returns an undefined value.
44 45 46 |
# File 'lib/procon_bypass_man/procon/performance_measurement.rb', line 44 def record_read_time(&block) @read_time = Benchmark.realtime { block.call } end |
#record_write_error ⇒ Object
33 34 35 |
# File 'lib/procon_bypass_man/procon/performance_measurement.rb', line 33 def record_write_error @write_error_count += 1 end |
#record_write_time(&block) ⇒ Object
37 38 39 40 41 |
# File 'lib/procon_bypass_man/procon/performance_measurement.rb', line 37 def record_write_time(&block) result = nil @write_time = Benchmark.realtime { result = block.call } return result end |