Class: ProconBypassMan::Procon::PerformanceMeasurement::PerformanceSpan

Inherits:
Object
  • Object
show all
Defined in:
lib/procon_bypass_man/procon/performance_measurement.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePerformanceSpan

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_timeObject (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_countObject

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_timeObject

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_succeedObject

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_countObject (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_timeObject (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

#succeedObject

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_takenObject

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_countObject (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_timeObject (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_errorObject



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_errorObject



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