Class: Benchmark::IPS::Job::StreamReport

Inherits:
Object
  • Object
show all
Defined in:
lib/benchmark/ips/job/stream_report.rb

Instance Method Summary collapse

Constructor Details

#initialize(stream = $stdout) ⇒ StreamReport

Returns a new instance of StreamReport.



5
6
7
8
# File 'lib/benchmark/ips/job/stream_report.rb', line 5

def initialize(stream = $stdout)
  @last_item = nil
  @out = stream
end

Instance Method Details

#add_report(item, caller) ⇒ Object



33
34
35
36
# File 'lib/benchmark/ips/job/stream_report.rb', line 33

def add_report(item, caller)
  @out.puts " #{item.body}"
  @last_item = item
end


38
39
40
41
42
# File 'lib/benchmark/ips/job/stream_report.rb', line 38

def footer
  return unless @last_item
  footer = @last_item.stats.footer
  @out.puts footer.rjust(40) if footer
end

#start_runningObject



14
15
16
# File 'lib/benchmark/ips/job/stream_report.rb', line 14

def start_running
  @out.puts "Calculating -------------------------------------"
end

#start_warmingObject



10
11
12
# File 'lib/benchmark/ips/job/stream_report.rb', line 10

def start_warming
  @out.puts "Warming up --------------------------------------"
end

#warming(label, _warmup) ⇒ Object Also known as: running



18
19
20
# File 'lib/benchmark/ips/job/stream_report.rb', line 18

def warming(label, _warmup)
  @out.print rjust(label)
end

#warmup_stats(_warmup_time_us, timing) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/benchmark/ips/job/stream_report.rb', line 22

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