class Benchmark::IPS::Job::StreamReport
Public Class Methods
new(stream = $stdout)
click to toggle source
# File lib/benchmark/ips/job/stream_report.rb, line 5 def initialize(stream = $stdout) @last_item = nil @out = stream end
Public Instance Methods
add_report(item, caller)
click to toggle source
# File lib/benchmark/ips/job/stream_report.rb, line 34 def add_report(item, caller) @out.puts " #{item.body}" @last_item = item end
start_running()
click to toggle source
# File lib/benchmark/ips/job/stream_report.rb, line 15 def start_running @out.puts "Calculating -------------------------------------" end
start_warming()
click to toggle source
# File lib/benchmark/ips/job/stream_report.rb, line 10 def start_warming @out.puts RUBY_DESCRIPTION @out.puts "Warming up --------------------------------------" end
warming(label, _warmup)
click to toggle source
# File lib/benchmark/ips/job/stream_report.rb, line 19 def warming(label, _warmup) @out.print rjust(label) end
Also aliased as: running
warmup_stats(_warmup_time_us, timing)
click to toggle source
# File lib/benchmark/ips/job/stream_report.rb, line 23 def warmup_stats(_warmup_time_us, timing) case format when :human @out.printf "%s i/100ms\n", Helpers.scale(timing) else @out.printf "%10d i/100ms\n", timing end end
Private Instance Methods
format()
click to toggle source
@return [Symbol] format used for benchmarking
# File lib/benchmark/ips/job/stream_report.rb, line 48 def format Benchmark::IPS.options[:format] end
rjust(label)
click to toggle source
Add padding to label’s right if label’s length < 20, Otherwise add a new line and 20 whitespaces. @return [String] Right justified label.
# File lib/benchmark/ips/job/stream_report.rb, line 55 def rjust(label) label = label.to_s if label.size > 20 "#{label}\n#{' ' * 20}" else label.rjust(20) end end