class Diagnostics::Sample::Result
Public Instance Methods
cycle(elapsed_time)
click to toggle source
# File lib/diagnostics/sample/result.rb, line 16 def cycle(elapsed_time) self.time_milliseconds += elapsed_time self.time_sum_squares += (elapsed_time ** 2) self.cycles += 1 end
cycles_per_second()
click to toggle source
# File lib/diagnostics/sample/result.rb, line 28 def cycles_per_second cycles / (time_milliseconds / 1_000) end
digest()
click to toggle source
# File lib/diagnostics/sample/result.rb, line 61 def digest <<~TEXT % [cycles, time_milliseconds, mean_cycle_time_milliseconds, standard_deviation, cycles_per_second, gc] Cycles: %d Time: %fms Mean Cycle Time: %fms (± %fms) Cycles Per Second: %f GC: #{gc ? 'on' : 'off'} TEXT end
Also aliased as: to_s
mean_cycle_time_milliseconds()
click to toggle source
# File lib/diagnostics/sample/result.rb, line 24 def mean_cycle_time_milliseconds time_milliseconds / cycles end
mean_warmup_time_milliseconds()
click to toggle source
# File lib/diagnostics/sample/result.rb, line 47 def mean_warmup_time_milliseconds warmup_time_milliseconds / warmup_cycles end
time_standard_deviation()
click to toggle source
# File lib/diagnostics/sample/result.rb, line 32 def time_standard_deviation variance = (time_sum_squares / cycles) - (mean_cycle_time_milliseconds ** 2) Math.sqrt(variance) end
Also aliased as: standard_deviation
warmup_cycle(elapsed_time)
click to toggle source
# File lib/diagnostics/sample/result.rb, line 39 def warmup_cycle(elapsed_time) self.warmup_time_milliseconds += elapsed_time self.warmup_time_sum_squares += (elapsed_time ** 2) self.warmup_cycles += 1 end
warmup_cycles_per_second()
click to toggle source
# File lib/diagnostics/sample/result.rb, line 51 def warmup_cycles_per_second warmup_cycles / (warmup_time_milliseconds / 1_000) end
warmup_time_standard_deviation()
click to toggle source
# File lib/diagnostics/sample/result.rb, line 55 def warmup_time_standard_deviation variance = (warmup_time_sum_squares / warmup_cycles) - (mean_warmup_time_milliseconds ** 2) Math.sqrt(variance) end